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