@farris/ui-vue 1.6.5-beta.7 → 1.6.5-beta.8
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.
- package/components/accordion/index.esm.js +65 -65
- package/components/accordion/index.umd.cjs +1 -1
- package/components/avatar/index.esm.js +28 -29
- package/components/avatar/index.umd.cjs +1 -1
- package/components/button-edit/index.esm.js +521 -517
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +134 -134
- package/components/calendar/index.umd.cjs +1 -1
- package/components/capsule/index.esm.js +192 -192
- package/components/capsule/index.umd.cjs +1 -1
- package/components/code-editor/index.esm.js +8 -8
- package/components/code-editor/index.umd.cjs +3 -3
- package/components/collection-property-editor/index.esm.js +72 -72
- package/components/collection-property-editor/index.umd.cjs +1 -1
- package/components/color-picker/index.esm.js +291 -289
- package/components/color-picker/index.umd.cjs +1 -1
- package/components/combo-list/index.esm.js +163 -157
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/combo-tree/index.esm.js +113 -112
- package/components/combo-tree/index.umd.cjs +1 -1
- package/components/common/index.esm.js +3 -1
- package/components/common/index.umd.cjs +1 -1
- package/components/component/index.esm.js +10 -10
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.esm.js +1122 -1121
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +190 -190
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-view/index.esm.js +2693 -2693
- package/components/data-view/index.umd.cjs +1 -1
- package/components/date-picker/index.esm.js +1604 -1601
- package/components/date-picker/index.umd.cjs +1 -1
- package/components/designer-canvas/index.esm.js +1082 -1079
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/discussion-editor/index.esm.js +973 -1040
- package/components/discussion-editor/index.umd.cjs +6 -6
- package/components/dropdown/index.esm.js +335 -330
- package/components/dropdown/index.umd.cjs +2 -2
- package/components/dynamic-form/index.esm.js +8 -8
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +6 -6
- package/components/dynamic-resolver/index.umd.cjs +1 -1
- package/components/dynamic-view/index.esm.js +344 -344
- package/components/dynamic-view/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +8 -8
- package/components/events-editor/index.umd.cjs +3 -3
- package/components/expression-editor/index.esm.js +1470 -1460
- package/components/expression-editor/index.umd.cjs +3 -3
- package/components/fieldset/index.esm.js +55 -55
- package/components/fieldset/index.umd.cjs +1 -1
- package/components/filter-bar/index.esm.js +853 -843
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/filter-condition-editor/index.esm.js +922 -911
- package/components/filter-condition-editor/index.umd.cjs +3 -3
- package/components/flow-canvas/index.esm.js +12 -12
- package/components/flow-canvas/index.umd.cjs +1 -1
- package/components/html-template/index.esm.js +164 -164
- package/components/html-template/index.umd.cjs +1 -1
- package/components/image-cropper/index.esm.js +198 -198
- package/components/image-cropper/index.umd.cjs +1 -1
- package/components/json-editor/index.esm.js +64 -64
- package/components/json-editor/index.umd.cjs +1 -1
- package/components/language-textbox/index.esm.js +140 -140
- package/components/language-textbox/index.umd.cjs +1 -1
- package/components/layout/index.esm.js +111 -111
- package/components/layout/index.umd.cjs +1 -1
- package/components/list-nav/index.esm.js +90 -90
- package/components/list-nav/index.umd.cjs +1 -1
- package/components/list-view/index.esm.js +104 -108
- package/components/list-view/index.umd.cjs +3 -3
- package/components/locale/index.esm.js +833 -901
- package/components/locale/index.umd.cjs +6 -6
- package/components/lookup/index.esm.js +1352 -1351
- package/components/lookup/index.umd.cjs +1 -1
- package/components/mapping-editor/index.esm.js +1311 -1307
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/menu-lookup/index.esm.js +1059 -1127
- package/components/menu-lookup/index.umd.cjs +6 -6
- package/components/message-box/index.esm.js +7 -7
- package/components/message-box/index.umd.cjs +1 -1
- package/components/modal/index.esm.js +9 -9
- package/components/modal/index.umd.cjs +1 -1
- package/components/nav/index.esm.js +106 -106
- package/components/nav/index.umd.cjs +1 -1
- package/components/number-range/index.esm.js +326 -326
- package/components/number-range/index.umd.cjs +1 -1
- package/components/number-spinner/index.esm.js +168 -167
- package/components/number-spinner/index.umd.cjs +1 -1
- package/components/order/index.esm.js +739 -737
- package/components/order/index.umd.cjs +4 -4
- package/components/page-footer/index.esm.js +94 -94
- package/components/page-footer/index.umd.cjs +1 -1
- package/components/page-header/index.esm.js +942 -939
- package/components/page-header/index.umd.cjs +1 -1
- package/components/pagination/index.esm.js +82 -82
- package/components/pagination/index.umd.cjs +1 -1
- package/components/popover/index.esm.js +1 -1
- package/components/popover/index.umd.cjs +1 -1
- package/components/progress/index.esm.js +113 -113
- package/components/progress/index.umd.cjs +2 -2
- package/components/property-editor/index.esm.js +151 -150
- package/components/property-editor/index.umd.cjs +1 -1
- package/components/property-panel/index.esm.js +565 -565
- package/components/property-panel/index.umd.cjs +2 -2
- package/components/query-solution/index.esm.js +4142 -4190
- package/components/query-solution/index.umd.cjs +6 -6
- package/components/radio-button/index.esm.js +182 -182
- package/components/radio-button/index.umd.cjs +1 -1
- package/components/rate/index.esm.js +106 -106
- package/components/rate/index.umd.cjs +1 -1
- package/components/response-layout/index.esm.js +409 -409
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/response-layout-editor/index.esm.js +1488 -1478
- package/components/response-layout-editor/index.umd.cjs +1 -1
- package/components/response-toolbar/index.esm.js +779 -776
- package/components/response-toolbar/index.umd.cjs +1 -1
- package/components/schema-selector/index.esm.js +1765 -1762
- package/components/schema-selector/index.umd.cjs +5 -5
- package/components/search-box/index.esm.js +114 -114
- package/components/search-box/index.umd.cjs +1 -1
- package/components/section/index.esm.js +1184 -1181
- package/components/section/index.umd.cjs +1 -1
- package/components/smoke-detector/index.esm.js +163 -163
- package/components/smoke-detector/index.umd.cjs +1 -1
- package/components/sort-condition-editor/index.esm.js +927 -916
- package/components/sort-condition-editor/index.umd.cjs +3 -3
- package/components/splitter/index.esm.js +3 -3
- package/components/splitter/index.umd.cjs +1 -1
- package/components/step/index.esm.js +133 -133
- package/components/step/index.umd.cjs +1 -1
- package/components/switch/index.esm.js +76 -72
- package/components/switch/index.umd.cjs +1 -1
- package/components/tabs/index.esm.js +1527 -1524
- package/components/tabs/index.umd.cjs +2 -2
- package/components/tags/index.esm.js +93 -93
- package/components/tags/index.umd.cjs +1 -1
- package/components/text/index.esm.js +138 -138
- package/components/text/index.umd.cjs +1 -1
- package/components/textarea/index.esm.js +361 -361
- package/components/textarea/index.umd.cjs +2 -2
- package/components/tooltip/index.esm.js +173 -171
- package/components/tooltip/index.umd.cjs +1 -1
- package/components/transfer/index.esm.js +130 -134
- package/components/transfer/index.umd.cjs +4 -4
- package/components/tree-grid/index.esm.js +25 -25
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.esm.js +1746 -1743
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +170 -170
- package/components/uploader/index.umd.cjs +2 -2
- package/components/verify-detail/index.esm.js +196 -196
- package/components/verify-detail/index.umd.cjs +1 -1
- package/components/video/index.esm.js +8 -8
- package/components/video/index.umd.cjs +1 -1
- package/components/weather/index.esm.js +9 -9
- package/components/weather/index.umd.cjs +2 -2
- package/farris.all.esm.js +16987 -17002
- package/farris.all.umd.cjs +27 -27
- package/package.json +1 -1
- package/types/lookup/src/composition/use-dialog.d.ts +2 -0
- package/types/lookup/src/composition/use-input-change.d.ts +1 -0
- package/components/time-picker/index.css +0 -1
- package/components/time-picker/index.esm.js +0 -9793
- package/components/time-picker/index.umd.cjs +0 -1
- package/components/time-picker/package.json +0 -8
- package/components/time-picker/style.js +0 -6
- package/designer/button-edit/index.css +0 -1
- package/designer/button-edit/index.esm.js +0 -4856
- package/designer/button-edit/index.umd.cjs +0 -1
- package/designer/checkbox/index.esm.js +0 -250
- package/designer/checkbox/index.umd.cjs +0 -1
- package/designer/checkbox-group/index.esm.js +0 -377
- package/designer/checkbox-group/index.umd.cjs +0 -1
- package/designer/data-grid/index.css +0 -1
- package/designer/data-grid/index.esm.js +0 -15413
- package/designer/data-grid/index.umd.cjs +0 -23
- package/designer/data-view/index.esm.js +0 -854
- package/designer/data-view/index.umd.cjs +0 -38
- package/designer/drawer/index.css +0 -1
- package/designer/drawer/index.esm.js +0 -525
- package/designer/drawer/index.umd.cjs +0 -1
- package/designer/farris-designer.all.esm.js +0 -22320
- package/designer/farris-designer.all.umd.cjs +0 -34
- package/designer/index.css +0 -1
- package/designer/input-group/index.esm.js +0 -1098
- package/designer/input-group/index.umd.cjs +0 -1
- package/designer/list-view/index.css +0 -1
- package/designer/list-view/index.esm.js +0 -4675
- package/designer/list-view/index.umd.cjs +0 -40
- package/designer/radio-group/index.css +0 -1
- package/designer/radio-group/index.esm.js +0 -6980
- package/designer/radio-group/index.umd.cjs +0 -1
- package/designer/tree-grid/index.esm.js +0 -1099
- package/designer/tree-grid/index.umd.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref as g, computed as T, defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { ref as g, computed as T, defineComponent as tt, watch as et, onMounted as ot, createVNode as y, Fragment as lt, Teleport as nt, nextTick as W, reactive as it, createApp as rt, onUnmounted as st, mergeProps as ct } from "vue";
|
|
2
|
+
const at = {
|
|
3
3
|
/** 提示内容 */
|
|
4
4
|
content: { type: String, default: "" },
|
|
5
5
|
/** 模板提示内容 */
|
|
@@ -22,108 +22,110 @@ const ct = {
|
|
|
22
22
|
// 是否根据溢出自动显示提示
|
|
23
23
|
overflowShown: { type: Boolean, default: !1 }
|
|
24
24
|
};
|
|
25
|
-
function
|
|
25
|
+
function ut(t, o) {
|
|
26
26
|
const n = /* @__PURE__ */ new Map([
|
|
27
27
|
["top", "bottom"],
|
|
28
28
|
["bottom", "top"],
|
|
29
29
|
["left", "right"],
|
|
30
30
|
["right", "left"]
|
|
31
|
-
]),
|
|
31
|
+
]), s = /* @__PURE__ */ new Map([
|
|
32
32
|
["top", "height"],
|
|
33
33
|
["bottom", "height"],
|
|
34
34
|
["left", "width"],
|
|
35
35
|
["right", "width"]
|
|
36
36
|
]);
|
|
37
|
-
function
|
|
37
|
+
function p(e, r) {
|
|
38
38
|
const u = n.get(r) || r;
|
|
39
39
|
return e.replace(r, u);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function c(e, r, u, l, d) {
|
|
42
42
|
let h = e;
|
|
43
|
-
const a = e.split("-")[0], f =
|
|
44
|
-
return Math.abs(u[a] - r[a]) < m && (h =
|
|
43
|
+
const a = e.split("-")[0], f = s.get(a), m = l[f] + d[f];
|
|
44
|
+
return Math.abs(u[a] - r[a]) < m && (h = p(e, a)), h;
|
|
45
45
|
}
|
|
46
|
-
return { adjustPlacement:
|
|
46
|
+
return { adjustPlacement: c };
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
function c
|
|
48
|
+
function ft(t, o) {
|
|
49
|
+
function s(c, e, r) {
|
|
50
50
|
let u = !1, l = r;
|
|
51
|
-
return (e === "left" || e === "top") && r <=
|
|
51
|
+
return (e === "left" || e === "top") && r <= c[e] && (u = !0, l = c[e] + 6), (e === "right" || e === "bottom") && r >= c[e] && (u = !0, l = c[e] - 6), { overBound: u, fixedValue: l };
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function p(c, e, r, u, l, d, h) {
|
|
54
54
|
let a = e.tooltip.left, f = e.tooltip.top, m = e.arrow.left, w = e.arrow.top;
|
|
55
|
-
const
|
|
56
|
-
if (["top", "bottom"].includes(
|
|
57
|
-
const
|
|
58
|
-
a =
|
|
55
|
+
const L = c.split("-")[0];
|
|
56
|
+
if (["top", "bottom"].includes(L)) {
|
|
57
|
+
const k = s(r, "left", e.tooltip.left), j = s(r, "right", e.tooltip.left + l.width);
|
|
58
|
+
a = k.overBound ? k.fixedValue : j.overBound ? j.fixedValue - l.width : e.tooltip.left, m = k.overBound ? l.width - (a + l.width - u.right) - h.width : j.overBound ? u.left - a : e.arrow.left;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
return f =
|
|
60
|
+
const E = s(r, "top", e.tooltip.top), x = s(r, "bottom", e.tooltip.top + l.height);
|
|
61
|
+
return f = E.overBound ? E.fixedValue : x.overBound ? x.fixedValue - l.height : e.tooltip.top, w = E.overBound ? e.arrow.top : x.overBound ? l.height - (f + l.height - u.top) : e.arrow.top, { arrow: { left: m, top: w }, tooltip: { left: a, top: f } };
|
|
62
62
|
}
|
|
63
|
-
return { adjustPosition:
|
|
63
|
+
return { adjustPosition: p };
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
function
|
|
67
|
-
const h = e.split("-"), a = h[0], f = h[1] || "middle", m = ["top", "bottom"].includes(a) ? f === "middle" ? (l.width -
|
|
68
|
-
return { left:
|
|
65
|
+
function pt(t, o) {
|
|
66
|
+
function s(e, r, u, l, d) {
|
|
67
|
+
const h = e.split("-"), a = h[0], f = h[1] || "middle", m = ["top", "bottom"].includes(a) ? f === "middle" ? (l.width - d.width) / 2 : f === "right" ? l.width - d.width - 6 : 6 : 0, w = ["left", "right"].includes(a) ? f === "middle" ? (l.height - d.height) / 2 : f === "bottom" ? l.height - d.height - 6 : 6 : 0, S = a === "left" ? l.width + d.width : 0, L = a === "top" ? l.height + d.height : 0;
|
|
68
|
+
return { left: S + m, top: L + w, right: 0 };
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
const h = e.split("-"), a = h[0], f = h[1] || "middle", m = (u.width - l.width) / 2, w = (u.height - l.height) / 2,
|
|
72
|
-
return { left:
|
|
70
|
+
function p(e, r, u, l, d) {
|
|
71
|
+
const h = e.split("-"), a = h[0], f = h[1] || "middle", m = (u.width - l.width) / 2, w = (u.height - l.height) / 2, S = a === "right" ? r.right : r.left, L = a === "bottom" ? r.bottom : r.top, E = a === "top" ? 0 - w - l.height - d.height : a === "bottom" ? 0 - w + d.height : 0, x = ["left", "right"].includes(a) ? f === "middle" ? (r.height - l.height) / 2 : f === "bottom" ? r.height - l.height : 0 : 0, C = a === "left" ? 0 - m - l.width - d.width : a === "right" ? 0 - m + d.width : 0, O = ["top", "bottom"].includes(a) ? f === "middle" ? (r.width - l.width) / 2 : f === "right" ? r.width - l.width : 0 : 0, k = L + E + x;
|
|
72
|
+
return { left: S + C + O, top: k };
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
const h =
|
|
76
|
-
return { arrow:
|
|
74
|
+
function c(e, r, u, l, d) {
|
|
75
|
+
const h = p(e, r, u, l, d);
|
|
76
|
+
return { arrow: s(e, r, u, l, d), tooltip: h };
|
|
77
77
|
}
|
|
78
|
-
return { calculate:
|
|
78
|
+
return { calculate: c };
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
const n = g(t.horizontalRelative),
|
|
82
|
-
function
|
|
80
|
+
function dt(t, o) {
|
|
81
|
+
const n = g(t.horizontalRelative), s = g(t.verticalRelative);
|
|
82
|
+
function p(e) {
|
|
83
83
|
return typeof e == "string" ? document.querySelector(e) : e;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
let e = document.documentElement.clientWidth, r = document.documentElement.clientHeight, u = 0, l = 0,
|
|
87
|
-
return n.value && ({ left: l, right: e, x:
|
|
85
|
+
function c() {
|
|
86
|
+
let e = document.documentElement.clientWidth, r = document.documentElement.clientHeight, u = 0, l = 0, d = 0, h = 0, a = r - u, f = e - l;
|
|
87
|
+
return n.value && ({ left: l, right: e, x: d, width: f } = p(n.value).getBoundingClientRect()), s.value && ({ bottom: r, top: u, y: h, height: a } = p(s.value).getBoundingClientRect()), { top: u, left: l, right: e, bottom: r, height: a, width: f, x: d, y: h };
|
|
88
88
|
}
|
|
89
|
-
return { getRelativeElementBound:
|
|
89
|
+
return { getRelativeElementBound: c };
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const e = g(t.placement), { getRelativeElementBound: r } =
|
|
91
|
+
function vt(t, o, n, s, p, c) {
|
|
92
|
+
const e = g(t.placement), { getRelativeElementBound: r } = dt(t), { calculate: u } = pt(), { adjustPlacement: l } = ut(), { adjustPosition: d } = ft(), h = T(() => e.value.split("-")[0]), a = T(() => {
|
|
93
93
|
const f = r();
|
|
94
|
-
e.value = l(e.value, f, n,
|
|
95
|
-
const m = u(e.value, n,
|
|
96
|
-
return
|
|
94
|
+
e.value = l(e.value, f, n, s, c);
|
|
95
|
+
const m = u(e.value, n, s, p, c);
|
|
96
|
+
return d(
|
|
97
97
|
e.value,
|
|
98
98
|
m,
|
|
99
99
|
f,
|
|
100
100
|
n,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
s,
|
|
102
|
+
p,
|
|
103
|
+
c
|
|
104
104
|
);
|
|
105
105
|
});
|
|
106
106
|
return { tooltipPlacement: h, tooltipPosition: a };
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
const o = g(), n = g(!1),
|
|
108
|
+
function ht(t) {
|
|
109
|
+
const o = g(), n = g(!1), s = T(() => ({
|
|
110
110
|
display: n.value ? "block" : "none"
|
|
111
|
-
})),
|
|
111
|
+
})), p = T(() => {
|
|
112
112
|
var e;
|
|
113
|
-
const
|
|
114
|
-
return
|
|
113
|
+
const c = (e = t.customClass) == null ? void 0 : e.split(" ");
|
|
114
|
+
return c == null ? void 0 : c.reduce((r, u) => (r[u] = !0, r), {});
|
|
115
115
|
});
|
|
116
|
-
return { showTooltip: n, tooltipDisplayStyle:
|
|
116
|
+
return { showTooltip: n, tooltipDisplayStyle: s, tooltipCustomClass: p, tooltipContainerRef: o };
|
|
117
117
|
}
|
|
118
|
-
const H = /* @__PURE__ */
|
|
118
|
+
const H = /* @__PURE__ */ tt({
|
|
119
119
|
name: "FTooltip",
|
|
120
|
-
props:
|
|
120
|
+
props: at,
|
|
121
121
|
emits: ["click"],
|
|
122
122
|
setup(t, o) {
|
|
123
|
-
const n = g(),
|
|
123
|
+
const n = g(), s = g(), p = g(), c = g(), e = g(), r = g(t.placement.split("-")[0]), u = ht(t), {
|
|
124
124
|
showTooltip: l,
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
tooltipDisplayStyle: d,
|
|
126
|
+
tooltipCustomClass: h,
|
|
127
|
+
tooltipContainerRef: a
|
|
128
|
+
} = u, f = g(!1), m = T(() => {
|
|
127
129
|
let i = {
|
|
128
130
|
"fv-tooltip": !0,
|
|
129
131
|
tooltip: !0,
|
|
@@ -132,243 +134,243 @@ const H = /* @__PURE__ */ Q({
|
|
|
132
134
|
const v = `bs-tooltip-${r.value}`;
|
|
133
135
|
return i[v] = !0, o.slots.default && (i = {
|
|
134
136
|
...i,
|
|
135
|
-
...
|
|
137
|
+
...h.value
|
|
136
138
|
}), i;
|
|
137
|
-
}),
|
|
139
|
+
}), w = (i) => {
|
|
138
140
|
i.stopPropagation(), i.target !== e.value && (l.value = !1);
|
|
139
|
-
},
|
|
141
|
+
}, S = T(() => t.content && !t.contentTemplate), L = T(() => t.content), E = g("0px"), x = g("0px"), C = T(() => {
|
|
140
142
|
const i = {
|
|
141
|
-
left:
|
|
142
|
-
top:
|
|
143
|
+
left: E.value,
|
|
144
|
+
top: x.value
|
|
143
145
|
};
|
|
144
146
|
return o.slots.default, i;
|
|
145
|
-
}),
|
|
146
|
-
left:
|
|
147
|
-
top:
|
|
148
|
-
})),
|
|
147
|
+
}), O = g(""), k = g(""), j = T(() => ({
|
|
148
|
+
left: O.value,
|
|
149
|
+
top: k.value
|
|
150
|
+
})), R = T(() => ({
|
|
149
151
|
"tooltip-inner": !0,
|
|
150
|
-
"tooltip-inner-lg":
|
|
151
|
-
})),
|
|
152
|
+
"tooltip-inner-lg": c.value && c.value && c.value.scrollHeight > c.value.clientHeight
|
|
153
|
+
})), V = T(() => {
|
|
152
154
|
const i = {};
|
|
153
155
|
return t.width && Object.assign(i, {
|
|
154
156
|
width: t.width,
|
|
155
157
|
"max-width": "none"
|
|
156
158
|
}), i;
|
|
157
|
-
}),
|
|
158
|
-
|
|
159
|
+
}), N = (i) => {
|
|
160
|
+
s.value && p.value && c.value && (R.value, W(() => {
|
|
159
161
|
const {
|
|
160
162
|
tooltipPlacement: v,
|
|
161
163
|
tooltipPosition: b
|
|
162
|
-
} =
|
|
163
|
-
|
|
164
|
+
} = vt(t, o, i.getBoundingClientRect(), p.value.getBoundingClientRect(), c.value.getBoundingClientRect(), s.value.getBoundingClientRect());
|
|
165
|
+
E.value = `${b.value.tooltip.left + document.documentElement.scrollLeft}px`, x.value = `${b.value.tooltip.top + document.documentElement.scrollTop}px`, O.value = `${b.value.arrow.left}px`, k.value = `${b.value.arrow.top}px`, r.value = v.value;
|
|
164
166
|
}));
|
|
165
167
|
}, A = (i) => {
|
|
166
168
|
var b;
|
|
167
169
|
const v = (b = n.value) == null ? void 0 : b.nextElementSibling;
|
|
168
|
-
v && (t.overflowShown && v.scrollWidth === v.clientWidth || (i.stopPropagation(), l.value = !0,
|
|
169
|
-
|
|
170
|
+
v && (t.overflowShown && v.scrollWidth === v.clientWidth || (i.stopPropagation(), l.value = !0, W(() => {
|
|
171
|
+
N(v);
|
|
170
172
|
})));
|
|
171
|
-
},
|
|
172
|
-
i.removeEventListener("mouseenter", A), i.removeEventListener("mouseleave",
|
|
173
|
+
}, F = (i, v = !0) => {
|
|
174
|
+
i.removeEventListener("mouseenter", A), i.removeEventListener("mouseleave", w), v && (i.addEventListener("mouseenter", A), i.addEventListener("mouseleave", w));
|
|
173
175
|
};
|
|
174
|
-
function
|
|
175
|
-
i.removeEventListener("mouseenter", A), i.removeEventListener("mouseleave",
|
|
176
|
+
function I(i, v = !0) {
|
|
177
|
+
i.removeEventListener("mouseenter", A), i.removeEventListener("mouseleave", w), v && (i.addEventListener("click", A), document.body.addEventListener("click", w));
|
|
176
178
|
}
|
|
177
179
|
function M() {
|
|
178
180
|
var v;
|
|
179
181
|
if (!t.enable)
|
|
180
182
|
return;
|
|
181
183
|
const i = (v = n.value) == null ? void 0 : v.nextElementSibling;
|
|
182
|
-
i && (t.trigger === "click" &&
|
|
184
|
+
i && (t.trigger === "click" && I(i), t.trigger === "hover" && F(i));
|
|
183
185
|
}
|
|
184
|
-
function
|
|
186
|
+
function _() {
|
|
185
187
|
var v;
|
|
186
188
|
const i = (v = n.value) == null ? void 0 : v.nextElementSibling;
|
|
187
|
-
i && (t.trigger === "click" &&
|
|
189
|
+
i && (t.trigger === "click" && I(i, !1), t.trigger === "hover" && F(i, !1));
|
|
188
190
|
}
|
|
189
|
-
|
|
190
|
-
i ? M() :
|
|
191
|
+
et(() => t.enable, (i) => {
|
|
192
|
+
i ? M() : _();
|
|
191
193
|
});
|
|
192
|
-
function
|
|
193
|
-
n.value && n.value.nodeName === "#text" && !n.value.nextElementSibling && (
|
|
194
|
+
function B() {
|
|
195
|
+
n.value && n.value.nodeName === "#text" && !n.value.nextElementSibling && (f.value = !0, W(() => {
|
|
194
196
|
M();
|
|
195
197
|
}));
|
|
196
198
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
ot(() => {
|
|
200
|
+
B(), M(), !S.value && t.contentTemplate && e.value && e.value.appendChild(t.contentTemplate), t.reference && N(t.reference);
|
|
199
201
|
});
|
|
200
|
-
function
|
|
202
|
+
function $(i) {
|
|
201
203
|
o.emit("click", i);
|
|
202
204
|
}
|
|
203
|
-
const
|
|
204
|
-
ref:
|
|
205
|
-
class:
|
|
206
|
-
style:
|
|
207
|
-
onClick:
|
|
205
|
+
const K = () => y("div", {
|
|
206
|
+
ref: p,
|
|
207
|
+
class: m.value,
|
|
208
|
+
style: C.value,
|
|
209
|
+
onClick: $
|
|
208
210
|
}, [y("div", {
|
|
209
|
-
ref: c,
|
|
210
|
-
class: "arrow",
|
|
211
|
-
style: O.value
|
|
212
|
-
}, null), y("div", {
|
|
213
211
|
ref: s,
|
|
214
|
-
class:
|
|
212
|
+
class: "arrow",
|
|
215
213
|
style: j.value
|
|
214
|
+
}, null), y("div", {
|
|
215
|
+
ref: c,
|
|
216
|
+
class: R.value,
|
|
217
|
+
style: V.value
|
|
216
218
|
}, [y("div", {
|
|
217
219
|
class: "tooltip-tmpl"
|
|
218
|
-
}, [
|
|
220
|
+
}, [S.value && y("div", {
|
|
219
221
|
class: "tooltip-text",
|
|
220
|
-
innerHTML:
|
|
221
|
-
}, null), !
|
|
222
|
+
innerHTML: L.value
|
|
223
|
+
}, null), !S.value && y("div", {
|
|
222
224
|
class: "tooltip-text",
|
|
223
225
|
ref: e
|
|
224
|
-
}, null)])])]),
|
|
225
|
-
ref:
|
|
226
|
-
class:
|
|
227
|
-
style:
|
|
228
|
-
onClick:
|
|
226
|
+
}, null)])])]), Q = () => y("div", {
|
|
227
|
+
ref: p,
|
|
228
|
+
class: m.value,
|
|
229
|
+
style: C.value,
|
|
230
|
+
onClick: $
|
|
229
231
|
}, [y("div", {
|
|
230
|
-
ref: c,
|
|
231
|
-
class: "arrow",
|
|
232
|
-
style: O.value
|
|
233
|
-
}, null), y("div", {
|
|
234
232
|
ref: s,
|
|
235
|
-
class:
|
|
233
|
+
class: "arrow",
|
|
236
234
|
style: j.value
|
|
235
|
+
}, null), y("div", {
|
|
236
|
+
ref: c,
|
|
237
|
+
class: R.value,
|
|
238
|
+
style: V.value
|
|
237
239
|
}, [y("div", {
|
|
238
240
|
class: "tooltip-tmpl"
|
|
239
241
|
}, [y("div", {
|
|
240
242
|
class: "tooltip-text",
|
|
241
243
|
ref: e
|
|
242
244
|
}, [o.slots.contentTemplate ? o.slots.contentTemplate() : t.content])])])]);
|
|
243
|
-
function
|
|
244
|
-
var i, v, b,
|
|
245
|
-
return
|
|
245
|
+
function Z() {
|
|
246
|
+
var i, v, b, q;
|
|
247
|
+
return f.value ? y("span", null, [(v = (i = o.slots).default) == null ? void 0 : v.call(i)]) : (q = (b = o.slots).default) == null ? void 0 : q.call(b);
|
|
246
248
|
}
|
|
247
|
-
return () => o.slots.default ? y(
|
|
249
|
+
return () => o.slots.default ? y(lt, {
|
|
248
250
|
ref: n
|
|
249
|
-
}, [
|
|
251
|
+
}, [Z(), y(nt, {
|
|
250
252
|
to: "body"
|
|
251
253
|
}, {
|
|
252
|
-
default: () => [l.value &&
|
|
253
|
-
})]) :
|
|
254
|
+
default: () => [l.value && Q()]
|
|
255
|
+
})]) : K();
|
|
254
256
|
}
|
|
255
257
|
});
|
|
256
|
-
function
|
|
258
|
+
function mt(t, o) {
|
|
257
259
|
const n = document.createElement("div");
|
|
258
260
|
t.customClass && (n.className = t.customClass);
|
|
259
|
-
const
|
|
261
|
+
const s = rt({
|
|
260
262
|
setup() {
|
|
261
|
-
function
|
|
262
|
-
t.clickToHide &&
|
|
263
|
+
function p() {
|
|
264
|
+
t.clickToHide && s.unmount();
|
|
263
265
|
}
|
|
264
|
-
return
|
|
266
|
+
return st(() => {
|
|
265
267
|
document.body.removeChild(n);
|
|
266
|
-
}), () => y(H,
|
|
267
|
-
onClick:
|
|
268
|
+
}), () => y(H, ct(t, {
|
|
269
|
+
onClick: p
|
|
268
270
|
}), null);
|
|
269
271
|
}
|
|
270
272
|
});
|
|
271
|
-
return document.body.appendChild(n),
|
|
273
|
+
return document.body.appendChild(n), s.mount(n), s;
|
|
272
274
|
}
|
|
273
|
-
function
|
|
274
|
-
const o =
|
|
275
|
+
function U(t) {
|
|
276
|
+
const o = it({
|
|
275
277
|
...t
|
|
276
278
|
});
|
|
277
|
-
return
|
|
279
|
+
return mt(o);
|
|
278
280
|
}
|
|
279
281
|
const P = /* @__PURE__ */ new WeakMap();
|
|
280
|
-
function
|
|
282
|
+
function X(t) {
|
|
281
283
|
if (!t)
|
|
282
284
|
return;
|
|
283
285
|
const o = P.get(t);
|
|
284
286
|
o && (o.unmount(), P.delete(t));
|
|
285
287
|
}
|
|
286
|
-
function
|
|
288
|
+
function gt(t, o) {
|
|
287
289
|
let n;
|
|
288
|
-
t.addEventListener("mouseenter", (
|
|
289
|
-
if (o.value.enable !== !1 && !(o.value.overflowShown && t.scrollWidth === t.clientWidth) && (
|
|
290
|
-
const
|
|
290
|
+
t.addEventListener("mouseenter", (s) => {
|
|
291
|
+
if (o.value.enable !== !1 && !(o.value.overflowShown && t.scrollWidth === t.clientWidth) && (s.stopPropagation(), !n)) {
|
|
292
|
+
const p = t.dataset.tooltip && JSON.parse(t.dataset.tooltip) || {}, c = Object.assign({
|
|
291
293
|
reference: t,
|
|
292
294
|
contentTemplate: o.value.contentTemplate
|
|
293
|
-
},
|
|
294
|
-
n =
|
|
295
|
+
}, p);
|
|
296
|
+
n = U(c), P.set(t, n);
|
|
295
297
|
}
|
|
296
|
-
}), t.addEventListener("mouseleave", (
|
|
297
|
-
|
|
298
|
+
}), t.addEventListener("mouseleave", (s) => {
|
|
299
|
+
s.stopPropagation(), n && (P.delete(t), n.unmount(), n = null);
|
|
298
300
|
});
|
|
299
301
|
}
|
|
300
|
-
let
|
|
301
|
-
const
|
|
302
|
-
function
|
|
303
|
-
document.querySelectorAll(`.${
|
|
304
|
-
|
|
302
|
+
let Y = null;
|
|
303
|
+
const z = "_farris-tooltip-directive_";
|
|
304
|
+
function D() {
|
|
305
|
+
document.querySelectorAll(`.${z}`).forEach((t) => {
|
|
306
|
+
X(t);
|
|
305
307
|
});
|
|
306
308
|
}
|
|
307
|
-
function
|
|
309
|
+
function yt(t, o) {
|
|
308
310
|
t.addEventListener("click", (n) => {
|
|
309
311
|
if (o.value.enable === !1 || o.value.overflowShown === !0 && t.scrollWidth === t.clientWidth)
|
|
310
312
|
return;
|
|
311
313
|
n.stopPropagation();
|
|
312
|
-
let
|
|
313
|
-
if (
|
|
314
|
-
|
|
314
|
+
let s = P.get(t);
|
|
315
|
+
if (s)
|
|
316
|
+
s.unmount(), P.delete(t);
|
|
315
317
|
else {
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
+
D();
|
|
319
|
+
const p = t.dataset.tooltip && JSON.parse(t.dataset.tooltip) || {}, c = Object.assign({
|
|
318
320
|
trigger: "hover",
|
|
319
321
|
reference: t
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
+
}, p);
|
|
323
|
+
s = U(c), P.set(t, s);
|
|
322
324
|
}
|
|
323
325
|
});
|
|
324
326
|
}
|
|
325
|
-
function
|
|
327
|
+
function G(t, o) {
|
|
326
328
|
if (!o.value)
|
|
327
329
|
t.dataset.tooltip = "";
|
|
328
330
|
else {
|
|
329
331
|
const {
|
|
330
332
|
contentTemplate: n,
|
|
331
|
-
...
|
|
333
|
+
...s
|
|
332
334
|
} = o.value;
|
|
333
|
-
t.dataset.tooltip = JSON.stringify(
|
|
335
|
+
t.dataset.tooltip = JSON.stringify(s);
|
|
334
336
|
}
|
|
335
337
|
}
|
|
336
|
-
function
|
|
337
|
-
o.value.trigger === "click" ||
|
|
338
|
+
function J(t, o) {
|
|
339
|
+
o.value.trigger === "click" || X(t);
|
|
338
340
|
}
|
|
339
|
-
const
|
|
341
|
+
const wt = {
|
|
340
342
|
mounted: (t, o, n) => {
|
|
341
|
-
switch (t.classList.add(
|
|
343
|
+
switch (t.classList.add(z), G(t, o), o.value.trigger) {
|
|
342
344
|
case "click": {
|
|
343
|
-
|
|
345
|
+
yt(t, o);
|
|
344
346
|
break;
|
|
345
347
|
}
|
|
346
348
|
default:
|
|
347
|
-
|
|
349
|
+
gt(t, o);
|
|
348
350
|
}
|
|
349
351
|
},
|
|
350
352
|
beforeUnmount: (t, o, n) => {
|
|
351
|
-
|
|
353
|
+
J(t, o);
|
|
352
354
|
},
|
|
353
355
|
unmounted: (t, o, n) => {
|
|
354
|
-
|
|
356
|
+
J(t, o);
|
|
355
357
|
},
|
|
356
358
|
beforeUpdate: (t, o) => {
|
|
357
|
-
|
|
359
|
+
G(t, o);
|
|
358
360
|
}
|
|
359
361
|
};
|
|
360
|
-
window.clearAllTooltips =
|
|
361
|
-
document.body.removeEventListener("click",
|
|
362
|
-
document.body.addEventListener("click",
|
|
363
|
-
const o = t.target, n = o.closest(`.${
|
|
364
|
-
n && P.has(n) || o.closest(".tooltip") ||
|
|
362
|
+
window.clearAllTooltips = D;
|
|
363
|
+
document.body.removeEventListener("click", Y, !0);
|
|
364
|
+
document.body.addEventListener("click", Y = (t) => {
|
|
365
|
+
const o = t.target, n = o.closest(`.${z}`);
|
|
366
|
+
n && P.has(n) || o.closest(".tooltip") || D();
|
|
365
367
|
}, !0);
|
|
366
368
|
H.install = (t) => {
|
|
367
|
-
t.component(H.name, H), t.directive("tooltip",
|
|
369
|
+
t.component(H.name, H), t.directive("tooltip", wt);
|
|
368
370
|
};
|
|
369
371
|
export {
|
|
370
372
|
H as FTooltip,
|
|
371
|
-
|
|
373
|
+
wt as FTooltipDirective,
|
|
372
374
|
H as default,
|
|
373
|
-
|
|
375
|
+
at as tooltipProps
|
|
374
376
|
};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 Y(t,n){const i=new Map([["top","bottom"],["bottom","top"],["left","right"],["right","left"]]),s=new Map([["top","height"],["bottom","height"],["left","width"],["right","width"]]);function p(o,c){const f=i.get(c)||c;return o.replace(c,f)}function a(o,c,f,l,h){let v=o;const u=o.split("-")[0],d=s.get(u),g=l[d]+h[d];return Math.abs(f[u]-c[u])<g&&(v=p(o,u)),v}return{adjustPlacement:a}}function B(t,n){function s(a,o,c){let f=!1,l=c;return(o==="left"||o==="top")&&c<=a[o]&&(f=!0,l=a[o]+6),(o==="right"||o==="bottom")&&c>=a[o]&&(f=!0,l=a[o]-6),{overBound:f,fixedValue:l}}function p(a,o,c,f,l,h,v){let u=o.tooltip.left,d=o.tooltip.top,g=o.arrow.left,y=o.arrow.top;const P=a.split("-")[0];if(["top","bottom"].includes(P)){const k=s(c,"left",o.tooltip.left),j=s(c,"right",o.tooltip.left+l.width);u=k.overBound?k.fixedValue:j.overBound?j.fixedValue-l.width:o.tooltip.left,g=k.overBound?l.width-(u+l.width-f.right)-v.width:j.overBound?f.left-u:o.arrow.left}const E=s(c,"top",o.tooltip.top),x=s(c,"bottom",o.tooltip.top+l.height);return d=E.overBound?E.fixedValue:x.overBound?x.fixedValue-l.height:o.tooltip.top,y=E.overBound?o.arrow.top:x.overBound?l.height-(d+l.height-f.top):o.arrow.top,{arrow:{left:g,top:y},tooltip:{left:u,top:d}}}return{adjustPosition:p}}function K(t,n){function s(o,c,f,l,h){const v=o.split("-"),u=v[0],d=v[1]||"middle",g=["top","bottom"].includes(u)?d==="middle"?(l.width-h.width)/2:d==="right"?l.width-h.width-6:6:0,y=["left","right"].includes(u)?d==="middle"?(l.height-h.height)/2:d==="bottom"?l.height-h.height-6:6:0,S=u==="left"?l.width+h.width:0,P=u==="top"?l.height+h.height:0;return{left:S+g,top:P+y,right:0}}function p(o,c,f,l,h){const v=o.split("-"),u=v[0],d=v[1]||"middle",g=(f.width-l.width)/2,y=(f.height-l.height)/2,S=u==="right"?c.right:c.left,P=u==="bottom"?c.bottom:c.top,E=u==="top"?0-y-l.height-h.height:u==="bottom"?0-y+h.height:0,x=["left","right"].includes(u)?d==="middle"?(c.height-l.height)/2:d==="bottom"?c.height-l.height:0:0,V=u==="left"?0-g-l.width-h.width:u==="right"?0-g+h.width:0,C=["top","bottom"].includes(u)?d==="middle"?(c.width-l.width)/2:d==="right"?c.width-l.width:0:0,k=P+E+x;return{left:S+V+C,top:k}}function a(o,c,f,l,h){const v=p(o,c,f,l,h);return{arrow:s(o,c,f,l,h),tooltip:v}}return{calculate:a}}function Q(t,n){const i=e.ref(t.horizontalRelative),s=e.ref(t.verticalRelative);function p(o){return typeof o=="string"?document.querySelector(o):o}function a(){let o=document.documentElement.clientWidth,c=document.documentElement.clientHeight,f=0,l=0,h=0,v=0,u=c-f,d=o-l;return i.value&&({left:l,right:o,x:h,width:d}=p(i.value).getBoundingClientRect()),s.value&&({bottom:c,top:f,y:v,height:u}=p(s.value).getBoundingClientRect()),{top:f,left:l,right:o,bottom:c,height:u,width:d,x:h,y:v}}return{getRelativeElementBound:a}}function Z(t,n,i,s,p,a){const o=e.ref(t.placement),{getRelativeElementBound:c}=Q(t),{calculate:f}=K(),{adjustPlacement:l}=Y(),{adjustPosition:h}=B(),v=e.computed(()=>o.value.split("-")[0]),u=e.computed(()=>{const d=c();o.value=l(o.value,d,i,s,a);const g=f(o.value,i,s,p,a);return h(o.value,g,d,i,s,p,a)});return{tooltipPlacement:v,tooltipPosition:u}}function tt(t){const n=e.ref(),i=e.ref(!1),s=e.computed(()=>({display:i.value?"block":"none"})),p=e.computed(()=>{var o;const a=(o=t.customClass)==null?void 0:o.split(" ");return a==null?void 0:a.reduce((c,f)=>(c[f]=!0,c),{})});return{showTooltip:i,tooltipDisplayStyle:s,tooltipCustomClass:p,tooltipContainerRef:n}}const L=e.defineComponent({name:"FTooltip",props:R,emits:["click"],setup(t,n){const i=e.ref(),s=e.ref(),p=e.ref(),a=e.ref(),o=e.ref(),c=e.ref(t.placement.split("-")[0]),f=tt(t),{showTooltip:l,tooltipDisplayStyle:h,tooltipCustomClass:v,tooltipContainerRef:u}=f,d=e.ref(!1),g=e.computed(()=>{let r={"fv-tooltip":!0,tooltip:!0,show:!0};const m=`bs-tooltip-${c.value}`;return r[m]=!0,n.slots.default&&(r={...r,...v.value}),r}),y=r=>{r.stopPropagation(),r.target!==o.value&&(l.value=!1)},S=e.computed(()=>t.content&&!t.contentTemplate),P=e.computed(()=>t.content),E=e.ref("0px"),x=e.ref("0px"),V=e.computed(()=>{const r={left:E.value,top:x.value};return n.slots.default,r}),C=e.ref(""),k=e.ref(""),j=e.computed(()=>({left:C.value,top:k.value})),H=e.computed(()=>({"tooltip-inner":!0,"tooltip-inner-lg":a.value&&a.value&&a.value.scrollHeight>a.value.clientHeight})),q=e.computed(()=>{const r={};return t.width&&Object.assign(r,{width:t.width,"max-width":"none"}),r}),_=r=>{s.value&&p.value&&a.value&&(H.value,e.nextTick(()=>{const{tooltipPlacement:m,tooltipPosition:T}=Z(t,n,r.getBoundingClientRect(),p.value.getBoundingClientRect(),a.value.getBoundingClientRect(),s.value.getBoundingClientRect());E.value=`${T.value.tooltip.left+document.documentElement.scrollLeft}px`,x.value=`${T.value.tooltip.top+document.documentElement.scrollTop}px`,C.value=`${T.value.arrow.left}px`,k.value=`${T.value.arrow.top}px`,c.value=m.value}))},N=r=>{var T;const m=(T=i.value)==null?void 0:T.nextElementSibling;m&&(t.overflowShown&&m.scrollWidth===m.clientWidth||(r.stopPropagation(),l.value=!0,e.nextTick(()=>{_(m)})))},G=(r,m=!0)=>{r.removeEventListener("mouseenter",N),r.removeEventListener("mouseleave",y),m&&(r.addEventListener("mouseenter",N),r.addEventListener("mouseleave",y))};function J(r,m=!0){r.removeEventListener("mouseenter",N),r.removeEventListener("mouseleave",y),m&&(r.addEventListener("click",N),document.body.addEventListener("click",y))}function M(){var m;if(!t.enable)return;const r=(m=i.value)==null?void 0:m.nextElementSibling;r&&(t.trigger==="click"&&J(r),t.trigger==="hover"&&G(r))}function lt(){var m;const r=(m=i.value)==null?void 0:m.nextElementSibling;r&&(t.trigger==="click"&&J(r,!1),t.trigger==="hover"&&G(r,!1))}e.watch(()=>t.enable,r=>{r?M():lt()});function it(){i.value&&i.value.nodeName==="#text"&&!i.value.nextElementSibling&&(d.value=!0,e.nextTick(()=>{M()}))}e.onMounted(()=>{it(),M(),!S.value&&t.contentTemplate&&o.value&&o.value.appendChild(t.contentTemplate),t.reference&&_(t.reference)});function U(r){n.emit("click",r)}const rt=()=>e.createVNode("div",{ref:p,class:g.value,style:V.value,onClick:U},[e.createVNode("div",{ref:s,class:"arrow",style:j.value},null),e.createVNode("div",{ref:a,class:H.value,style:q.value},[e.createVNode("div",{class:"tooltip-tmpl"},[S.value&&e.createVNode("div",{class:"tooltip-text",innerHTML:P.value},null),!S.value&&e.createVNode("div",{class:"tooltip-text",ref:o},null)])])]),ct=()=>e.createVNode("div",{ref:p,class:g.value,style:V.value,onClick:U},[e.createVNode("div",{ref:s,class:"arrow",style:j.value},null),e.createVNode("div",{ref:a,class:H.value,style:q.value},[e.createVNode("div",{class:"tooltip-tmpl"},[e.createVNode("div",{class:"tooltip-text",ref:o},[n.slots.contentTemplate?n.slots.contentTemplate():t.content])])])]);function st(){var r,m,T,X;return d.value?e.createVNode("span",null,[(m=(r=n.slots).default)==null?void 0:m.call(r)]):(X=(T=n.slots).default)==null?void 0:X.call(T)}return()=>n.slots.default?e.createVNode(e.Fragment,{ref:i},[st(),e.createVNode(e.Teleport,{to:"body"},{default:()=>[l.value&&ct()]})]):rt()}});function et(t,n){const i=document.createElement("div");t.customClass&&(i.className=t.customClass);const s=e.createApp({setup(){function p(){t.clickToHide&&s.unmount()}return e.onUnmounted(()=>{document.body.removeChild(i)}),()=>e.createVNode(L,e.mergeProps(t,{onClick:p}),null)}});return document.body.appendChild(i),s.mount(i),s}function W(t){const n=e.reactive({...t});return et(n)}const b=new WeakMap;function z(t){if(!t)return;const n=b.get(t);n&&(n.unmount(),b.delete(t))}function ot(t,n){let i;t.addEventListener("mouseenter",s=>{if(n.value.enable!==!1&&!(n.value.overflowShown&&t.scrollWidth===t.clientWidth)&&(s.stopPropagation(),!i)){const p=t.dataset.tooltip&&JSON.parse(t.dataset.tooltip)||{},a=Object.assign({reference:t,contentTemplate:n.value.contentTemplate},p);i=W(a),b.set(t,i)}}),t.addEventListener("mouseleave",s=>{s.stopPropagation(),i&&(b.delete(t),i.unmount(),i=null)})}let D=null;const O="_farris-tooltip-directive_";function A(){document.querySelectorAll(`.${O}`).forEach(t=>{z(t)})}function nt(t,n){t.addEventListener("click",i=>{if(n.value.enable===!1||n.value.overflowShown===!0&&t.scrollWidth===t.clientWidth)return;i.stopPropagation();let s=b.get(t);if(s)s.unmount(),b.delete(t);else{A();const p=t.dataset.tooltip&&JSON.parse(t.dataset.tooltip)||{},a=Object.assign({trigger:"hover",reference:t},p);s=W(a),b.set(t,s)}})}function F(t,n){if(!n.value)t.dataset.tooltip="";else{const{contentTemplate:i,...s}=n.value;t.dataset.tooltip=JSON.stringify(s)}}function I(t,n){n.value.trigger==="click"||z(t)}const $={mounted:(t,n,i)=>{switch(t.classList.add(O),F(t,n),n.value.trigger){case"click":{nt(t,n);break}default:ot(t,n)}},beforeUnmount:(t,n,i)=>{I(t,n)},unmounted:(t,n,i)=>{I(t,n)},beforeUpdate:(t,n)=>{F(t,n)}};window.clearAllTooltips=A,document.body.removeEventListener("click",D,!0),document.body.addEventListener("click",D=t=>{const n=t.target,i=n.closest(`.${O}`);i&&b.has(i)||n.closest(".tooltip")||A()},!0),L.install=t=>{t.component(L.name,L),t.directive("tooltip",$)},w.FTooltip=L,w.FTooltipDirective=$,w.default=L,w.tooltipProps=R,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|