yc-pro-components 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { defineComponent, useSlots, ref, resolveComponent, openBlock, createBlock, mergeProps, withCtx, renderSlot, createVNode, withModifiers } from 'vue';
1
+ import { defineComponent, useSlots, ref, computed, resolveComponent, openBlock, createBlock, mergeProps, withCtx, renderSlot, createVNode, withModifiers } from 'vue';
2
2
 
3
3
  var _sfc_main = /* @__PURE__ */ defineComponent({
4
4
  ...{
@@ -21,6 +21,32 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
21
21
  useSlots();
22
22
  const textRef = ref();
23
23
  const showTooltip = ref(false);
24
+ const tooltipProps = computed(() => {
25
+ const { offset, popperOptions: popperOptions2, ...rest } = props.tippyProps;
26
+ return rest;
27
+ });
28
+ const popperOptions = computed(() => {
29
+ var _a, _b, _c;
30
+ const offset = (_a = props.tippyProps) == null ? void 0 : _a.offset;
31
+ const userPopperOptions = (_b = props.tippyProps) == null ? void 0 : _b.popperOptions;
32
+ if (!Array.isArray(offset)) {
33
+ return userPopperOptions;
34
+ }
35
+ const normalizedOffset = [Number(offset[0]) || 0, Number(offset[1]) || 0];
36
+ const userModifiers = (_c = userPopperOptions == null ? void 0 : userPopperOptions.modifiers) != null ? _c : [];
37
+ return {
38
+ ...userPopperOptions,
39
+ modifiers: [
40
+ ...userModifiers,
41
+ {
42
+ name: "offset",
43
+ options: {
44
+ offset: normalizedOffset
45
+ }
46
+ }
47
+ ]
48
+ };
49
+ });
24
50
  const isTextEllipsis = (el) => {
25
51
  if (!props.lineClamp) {
26
52
  return el.scrollWidth > el.clientWidth;
@@ -36,8 +62,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
36
62
  const _component_el_tooltip = resolveComponent("el-tooltip");
37
63
  return openBlock(), createBlock(_component_el_tooltip, mergeProps({
38
64
  disabled: !showTooltip.value,
39
- content: __props.tippyProps.content
40
- }, __props.tippyProps), {
65
+ content: __props.tippyProps.content,
66
+ "popper-options": popperOptions.value
67
+ }, tooltipProps.value), {
41
68
  content: withCtx(() => [
42
69
  renderSlot(_ctx.$slots, "content", {}, () => [
43
70
  renderSlot(_ctx.$slots, "default")
@@ -68,7 +95,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
68
95
  ]),
69
96
  _: 3
70
97
  /* FORWARDED */
71
- }, 16, ["disabled", "content"]);
98
+ }, 16, ["disabled", "content", "popper-options"]);
72
99
  };
73
100
  }
74
101
  });
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! yc-pro-components v0.0.9 */
1
+ /*! yc-pro-components v0.0.11 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus'], factory) :
@@ -58440,6 +58440,32 @@
58440
58440
  vue.useSlots();
58441
58441
  const textRef = vue.ref();
58442
58442
  const showTooltip = vue.ref(false);
58443
+ const tooltipProps = vue.computed(() => {
58444
+ const { offset, popperOptions: popperOptions2, ...rest } = props.tippyProps;
58445
+ return rest;
58446
+ });
58447
+ const popperOptions = vue.computed(() => {
58448
+ var _a, _b, _c;
58449
+ const offset = (_a = props.tippyProps) == null ? void 0 : _a.offset;
58450
+ const userPopperOptions = (_b = props.tippyProps) == null ? void 0 : _b.popperOptions;
58451
+ if (!Array.isArray(offset)) {
58452
+ return userPopperOptions;
58453
+ }
58454
+ const normalizedOffset = [Number(offset[0]) || 0, Number(offset[1]) || 0];
58455
+ const userModifiers = (_c = userPopperOptions == null ? void 0 : userPopperOptions.modifiers) != null ? _c : [];
58456
+ return {
58457
+ ...userPopperOptions,
58458
+ modifiers: [
58459
+ ...userModifiers,
58460
+ {
58461
+ name: "offset",
58462
+ options: {
58463
+ offset: normalizedOffset
58464
+ }
58465
+ }
58466
+ ]
58467
+ };
58468
+ });
58443
58469
  const isTextEllipsis = (el) => {
58444
58470
  if (!props.lineClamp) {
58445
58471
  return el.scrollWidth > el.clientWidth;
@@ -58455,8 +58481,9 @@
58455
58481
  const _component_el_tooltip = vue.resolveComponent("el-tooltip");
58456
58482
  return vue.openBlock(), vue.createBlock(_component_el_tooltip, vue.mergeProps({
58457
58483
  disabled: !showTooltip.value,
58458
- content: __props.tippyProps.content
58459
- }, __props.tippyProps), {
58484
+ content: __props.tippyProps.content,
58485
+ "popper-options": popperOptions.value
58486
+ }, tooltipProps.value), {
58460
58487
  content: vue.withCtx(() => [
58461
58488
  vue.renderSlot(_ctx.$slots, "content", {}, () => [
58462
58489
  vue.renderSlot(_ctx.$slots, "default")
@@ -58487,7 +58514,7 @@
58487
58514
  ]),
58488
58515
  _: 3
58489
58516
  /* FORWARDED */
58490
- }, 16, ["disabled", "content"]);
58517
+ }, 16, ["disabled", "content", "popper-options"]);
58491
58518
  };
58492
58519
  }
58493
58520
  });