@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.
- package/components/avatar/index.esm.js +897 -901
- package/components/avatar/index.umd.cjs +1 -1
- package/components/combo-list/index.esm.js +483 -487
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/component/index.esm.js +482 -486
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.esm.js +543 -547
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +619 -623
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-grid/index.esm.js +439 -440
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.esm.js +423 -425
- package/components/data-view/index.umd.cjs +1 -1
- package/components/designer-canvas/index.esm.js +529 -533
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/dynamic-form/index.esm.js +723 -727
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +504 -508
- package/components/events-editor/index.umd.cjs +1 -1
- package/components/expression-editor/index.esm.js +679 -683
- package/components/expression-editor/index.umd.cjs +4 -4
- package/components/filter-bar/index.esm.js +503 -507
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/filter-condition-editor/index.esm.js +557 -561
- package/components/filter-condition-editor/index.umd.cjs +4 -4
- package/components/flow-canvas/index.esm.js +327 -331
- package/components/flow-canvas/index.umd.cjs +1 -1
- package/components/list-view/index.esm.js +502 -506
- package/components/list-view/index.umd.cjs +2 -2
- package/components/mapping-editor/index.esm.js +347 -348
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/number-range/index.esm.js +479 -483
- package/components/number-range/index.umd.cjs +1 -1
- package/components/number-spinner/index.esm.js +1037 -1041
- package/components/number-spinner/index.umd.cjs +1 -1
- package/components/order/index.esm.js +1238 -1242
- package/components/order/index.umd.cjs +2 -2
- package/components/pagination/index.esm.js +94 -91
- package/components/pagination/index.umd.cjs +1 -1
- package/components/property-panel/index.esm.js +534 -538
- package/components/property-panel/index.umd.cjs +2 -2
- package/components/query-solution/index.esm.js +785 -789
- package/components/query-solution/index.umd.cjs +5 -5
- package/components/response-layout/index.esm.js +710 -714
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/schema-selector/index.esm.js +701 -702
- package/components/schema-selector/index.umd.cjs +3 -3
- package/components/section/index.esm.js +502 -506
- package/components/section/index.umd.cjs +1 -1
- package/components/sort-condition-editor/index.esm.js +556 -560
- package/components/sort-condition-editor/index.umd.cjs +4 -4
- package/components/textarea/index.esm.js +480 -484
- package/components/textarea/index.umd.cjs +2 -2
- package/components/time-picker/index.esm.js +594 -598
- package/components/time-picker/index.umd.cjs +1 -1
- package/components/tooltip/index.esm.js +189 -179
- package/components/tooltip/index.umd.cjs +1 -1
- package/components/tree-grid/index.esm.js +463 -467
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.esm.js +629 -633
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/video/index.esm.js +632 -636
- package/components/video/index.umd.cjs +1 -1
- package/farris.all.esm.js +2583 -2569
- package/farris.all.umd.cjs +11 -11
- package/index.css +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref as g, computed as b, defineComponent as
|
|
2
|
-
const
|
|
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
|
|
26
|
-
const
|
|
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
|
-
]),
|
|
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,
|
|
38
|
-
const u =
|
|
39
|
-
return e.replace(
|
|
37
|
+
function f(e, c) {
|
|
38
|
+
const u = r.get(c) || c;
|
|
39
|
+
return e.replace(c, u);
|
|
40
40
|
}
|
|
41
|
-
function s(e,
|
|
42
|
-
let
|
|
43
|
-
const a = e.split("-")[0], p =
|
|
44
|
-
return Math.abs(u[a] -
|
|
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
|
|
49
|
-
function
|
|
50
|
-
let u = !1, o =
|
|
51
|
-
return (e === "left" || e === "top") &&
|
|
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,
|
|
54
|
-
let a = e.tooltip.left, p = e.tooltip.top,
|
|
55
|
-
const
|
|
56
|
-
if (["top", "bottom"].includes(
|
|
57
|
-
const
|
|
58
|
-
a =
|
|
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
|
|
61
|
-
return 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
|
|
66
|
-
function
|
|
67
|
-
const
|
|
68
|
-
return { left:
|
|
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,
|
|
71
|
-
const
|
|
72
|
-
return { left:
|
|
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,
|
|
75
|
-
const
|
|
76
|
-
return { arrow:
|
|
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
|
|
81
|
-
const
|
|
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,
|
|
87
|
-
return
|
|
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
|
|
92
|
-
const e = g(t.placement), { getRelativeElementBound:
|
|
93
|
-
const p =
|
|
94
|
-
e.value = o(e.value, p,
|
|
95
|
-
const
|
|
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
|
-
|
|
98
|
+
m,
|
|
99
99
|
p,
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
r,
|
|
101
|
+
i,
|
|
102
102
|
f,
|
|
103
103
|
s
|
|
104
104
|
);
|
|
105
105
|
});
|
|
106
|
-
return { tooltipPlacement:
|
|
106
|
+
return { tooltipPlacement: h, tooltipPosition: a };
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
const l = g(),
|
|
110
|
-
display:
|
|
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((
|
|
114
|
+
return s == null ? void 0 : s.reduce((c, u) => (c[u] = !0, c), {});
|
|
115
115
|
});
|
|
116
|
-
return { showTooltip:
|
|
116
|
+
return { showTooltip: r, tooltipDisplayStyle: i, tooltipCustomClass: f, tooltipContainerRef: l };
|
|
117
117
|
}
|
|
118
|
-
const H = /* @__PURE__ */
|
|
118
|
+
const H = /* @__PURE__ */ K({
|
|
119
119
|
name: "FTooltip",
|
|
120
|
-
props:
|
|
120
|
+
props: rt,
|
|
121
121
|
emits: ["click"],
|
|
122
122
|
setup(t, l) {
|
|
123
|
-
const
|
|
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:
|
|
126
|
+
tooltipCustomClass: h,
|
|
127
127
|
tooltipContainerRef: a
|
|
128
|
-
} = u, p = b(() => {
|
|
129
|
-
let
|
|
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
|
|
135
|
-
return
|
|
136
|
-
...
|
|
137
|
-
...
|
|
138
|
-
}),
|
|
139
|
-
}),
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
const
|
|
143
|
-
left:
|
|
144
|
-
top:
|
|
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,
|
|
147
|
-
}),
|
|
148
|
-
left:
|
|
149
|
-
top:
|
|
150
|
-
})),
|
|
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
|
-
})),
|
|
154
|
-
const
|
|
155
|
-
return t.width && Object.assign(
|
|
153
|
+
})), V = b(() => {
|
|
154
|
+
const n = {};
|
|
155
|
+
return t.width && Object.assign(n, {
|
|
156
156
|
width: t.width,
|
|
157
157
|
"max-width": "none"
|
|
158
|
-
}),
|
|
159
|
-
}),
|
|
160
|
-
|
|
158
|
+
}), n;
|
|
159
|
+
}), N = (n) => {
|
|
160
|
+
i.value && f.value && s.value && (M.value, W(() => {
|
|
161
161
|
const {
|
|
162
|
-
tooltipPlacement:
|
|
163
|
-
tooltipPosition:
|
|
164
|
-
} =
|
|
165
|
-
|
|
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 = (
|
|
168
|
-
var
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
},
|
|
174
|
-
|
|
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
|
|
177
|
-
|
|
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
|
|
180
|
-
var
|
|
179
|
+
function R() {
|
|
180
|
+
var v;
|
|
181
181
|
if (!t.enable)
|
|
182
182
|
return;
|
|
183
|
-
const
|
|
184
|
-
|
|
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
|
|
187
|
-
var
|
|
188
|
-
const
|
|
189
|
-
|
|
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
|
-
|
|
192
|
-
|
|
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
|
|
197
|
-
l.emit("click",
|
|
202
|
+
function I(n) {
|
|
203
|
+
l.emit("click", n);
|
|
198
204
|
}
|
|
199
|
-
const
|
|
205
|
+
const U = () => y("div", {
|
|
200
206
|
ref: f,
|
|
201
|
-
class:
|
|
202
|
-
style:
|
|
203
|
-
onClick:
|
|
207
|
+
class: m.value,
|
|
208
|
+
style: C.value,
|
|
209
|
+
onClick: I
|
|
204
210
|
}, [y("div", {
|
|
205
|
-
ref:
|
|
211
|
+
ref: i,
|
|
206
212
|
class: "arrow",
|
|
207
|
-
style:
|
|
213
|
+
style: L.value
|
|
208
214
|
}, null), y("div", {
|
|
209
215
|
ref: s,
|
|
210
|
-
class:
|
|
211
|
-
style:
|
|
216
|
+
class: M.value,
|
|
217
|
+
style: V.value
|
|
212
218
|
}, [y("div", {
|
|
213
219
|
class: "tooltip-tmpl"
|
|
214
|
-
}, [
|
|
220
|
+
}, [S.value && y("div", {
|
|
215
221
|
class: "tooltip-text",
|
|
216
|
-
innerHTML:
|
|
217
|
-
}, null), !
|
|
222
|
+
innerHTML: P.value
|
|
223
|
+
}, null), !S.value && y("div", {
|
|
218
224
|
class: "tooltip-text",
|
|
219
225
|
ref: e
|
|
220
|
-
}, null)])])]),
|
|
226
|
+
}, null)])])]), _ = () => y("div", {
|
|
221
227
|
ref: f,
|
|
222
|
-
class:
|
|
223
|
-
style:
|
|
224
|
-
onClick:
|
|
228
|
+
class: m.value,
|
|
229
|
+
style: C.value,
|
|
230
|
+
onClick: I
|
|
225
231
|
}, [y("div", {
|
|
226
|
-
ref:
|
|
232
|
+
ref: i,
|
|
227
233
|
class: "arrow",
|
|
228
|
-
style:
|
|
234
|
+
style: L.value
|
|
229
235
|
}, null), y("div", {
|
|
230
236
|
ref: s,
|
|
231
|
-
class:
|
|
232
|
-
style:
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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 &&
|
|
245
|
-
})]) :
|
|
254
|
+
default: () => [o.value && _()]
|
|
255
|
+
})]) : U();
|
|
246
256
|
}
|
|
247
257
|
});
|
|
248
|
-
function
|
|
249
|
-
const
|
|
250
|
-
t.customClass && (
|
|
251
|
-
const
|
|
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 &&
|
|
264
|
+
t.clickToHide && i.unmount();
|
|
255
265
|
}
|
|
256
|
-
return
|
|
257
|
-
document.body.removeChild(
|
|
258
|
-
}), () => y(H,
|
|
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(
|
|
273
|
+
return document.body.appendChild(r), i.mount(r), i;
|
|
264
274
|
}
|
|
265
|
-
function
|
|
266
|
-
const l =
|
|
275
|
+
function J(t) {
|
|
276
|
+
const l = ot({
|
|
267
277
|
...t
|
|
268
278
|
});
|
|
269
|
-
return
|
|
279
|
+
return dt(l);
|
|
270
280
|
}
|
|
271
|
-
function
|
|
272
|
-
let
|
|
273
|
-
t.addEventListener("mouseenter", (
|
|
274
|
-
if (l.value.enable !== !1 && !(l.value.overflowShown && t.scrollWidth === t.clientWidth) && (
|
|
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
|
-
|
|
289
|
+
r = J(s);
|
|
280
290
|
}
|
|
281
|
-
}), t.addEventListener("mouseleave", (
|
|
282
|
-
|
|
291
|
+
}), t.addEventListener("mouseleave", (i) => {
|
|
292
|
+
i.stopPropagation(), r && (r.unmount(), r = null);
|
|
283
293
|
});
|
|
284
294
|
}
|
|
285
|
-
let
|
|
286
|
-
const j = /* @__PURE__ */ new WeakMap(),
|
|
287
|
-
function
|
|
288
|
-
document.querySelectorAll(`.${
|
|
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
|
|
294
|
-
t.addEventListener("click", (
|
|
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
|
-
|
|
298
|
-
let
|
|
299
|
-
if (
|
|
300
|
-
|
|
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
|
-
|
|
316
|
+
i = J(s), j.set(t, i);
|
|
307
317
|
}
|
|
308
|
-
}), !
|
|
309
|
-
const
|
|
310
|
-
f && j.has(f) ||
|
|
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
|
|
323
|
+
function G(t, l) {
|
|
314
324
|
if (!l.value)
|
|
315
325
|
t.dataset.tooltip = "";
|
|
316
326
|
else {
|
|
317
327
|
const {
|
|
318
|
-
contentTemplate:
|
|
319
|
-
...
|
|
328
|
+
contentTemplate: r,
|
|
329
|
+
...i
|
|
320
330
|
} = l.value;
|
|
321
|
-
t.dataset.tooltip = JSON.stringify(
|
|
331
|
+
t.dataset.tooltip = JSON.stringify(i);
|
|
322
332
|
}
|
|
323
333
|
}
|
|
324
|
-
const
|
|
325
|
-
mounted: (t, l,
|
|
326
|
-
switch (t.classList.add(
|
|
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
|
-
|
|
338
|
+
mt(t, l);
|
|
329
339
|
break;
|
|
330
340
|
}
|
|
331
341
|
default:
|
|
332
|
-
|
|
342
|
+
vt(t, l);
|
|
333
343
|
}
|
|
334
344
|
},
|
|
335
|
-
unMounted: (t, l,
|
|
336
|
-
l.value.trigger === "click" && document.body.removeEventListener("click",
|
|
345
|
+
unMounted: (t, l, r) => {
|
|
346
|
+
l.value.trigger === "click" && document.body.removeEventListener("click", z, !0);
|
|
337
347
|
},
|
|
338
348
|
beforeUpdate: (t, l) => {
|
|
339
|
-
|
|
349
|
+
G(t, l);
|
|
340
350
|
}
|
|
341
351
|
};
|
|
342
352
|
H.install = (t) => {
|
|
343
|
-
t.component(H.name, H), t.directive("tooltip",
|
|
353
|
+
t.component(H.name, H), t.directive("tooltip", gt);
|
|
344
354
|
};
|
|
345
355
|
export {
|
|
346
356
|
H as FTooltip,
|
|
347
|
-
|
|
357
|
+
gt as FTooltipDirective,
|
|
348
358
|
H as default,
|
|
349
|
-
|
|
359
|
+
rt as tooltipProps
|
|
350
360
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(w,
|
|
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"}})});
|