savor-ui 0.3.2 → 0.4.0

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 (135) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/es/components/index.d.ts +4 -0
  3. package/dist/es/components/index.mjs +6 -1
  4. package/dist/es/components/src/alert/alert.d.ts +22 -0
  5. package/dist/es/components/src/alert/alert.vue.mjs +5 -0
  6. package/dist/es/components/src/alert/alert.vue_vue_type_script_setup_true_vapor_true_lang.mjs +58 -0
  7. package/dist/es/components/src/alert/index.d.ts +26 -0
  8. package/dist/es/components/src/alert/index.mjs +7 -0
  9. package/dist/es/components/src/alert/types.d.ts +24 -0
  10. package/dist/es/components/src/cascader/cascader.vue_vue_type_script_setup_true_vapor_true_lang.mjs +93 -82
  11. package/dist/es/components/src/cascader/index.d.ts +1 -0
  12. package/dist/es/components/src/cascader/types.d.ts +2 -0
  13. package/dist/es/components/src/chat-list/chat-list.d.ts +35 -0
  14. package/dist/es/components/src/chat-list/chat-list.vue.mjs +5 -0
  15. package/dist/es/components/src/chat-list/chat-list.vue_vue_type_script_setup_true_vapor_true_lang.mjs +55 -0
  16. package/dist/es/components/src/chat-list/index.d.ts +47 -0
  17. package/dist/es/components/src/chat-list/index.mjs +7 -0
  18. package/dist/es/components/src/chat-list/types.d.ts +44 -0
  19. package/dist/es/components/src/chat-sender/chat-sender.d.ts +26 -0
  20. package/dist/es/components/src/chat-sender/chat-sender.vue.mjs +5 -0
  21. package/dist/es/components/src/chat-sender/chat-sender.vue_vue_type_script_setup_true_vapor_true_lang.mjs +92 -0
  22. package/dist/es/components/src/chat-sender/index.d.ts +27 -0
  23. package/dist/es/components/src/chat-sender/index.mjs +7 -0
  24. package/dist/es/components/src/chat-sender/types.d.ts +24 -0
  25. package/dist/es/components/src/collapse/collapse-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -2
  26. package/dist/es/components/src/date-picker/date-picker.vue_vue_type_script_setup_true_vapor_true_lang.mjs +28 -28
  27. package/dist/es/components/src/datetime-picker/datetime-picker.vue_vue_type_script_setup_true_vapor_true_lang.mjs +28 -28
  28. package/dist/es/components/src/drawer/drawer.vue_vue_type_script_setup_true_vapor_true_lang.mjs +72 -72
  29. package/dist/es/components/src/form/form-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +13 -13
  30. package/dist/es/components/src/form/use-form-item.d.ts +1 -1
  31. package/dist/es/components/src/grid/grid-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +26 -17
  32. package/dist/es/components/src/grid/grid.vue_vue_type_script_setup_true_vapor_true_lang.mjs +10 -6
  33. package/dist/es/components/src/grid/types.d.ts +2 -0
  34. package/dist/es/components/src/input/input.vue_vue_type_script_setup_true_vapor_true_lang.mjs +9 -9
  35. package/dist/es/components/src/input-number/input-number.vue_vue_type_script_setup_true_vapor_true_lang.mjs +83 -83
  36. package/dist/es/components/src/input-tag/input-tag.vue_vue_type_script_setup_true_vapor_true_lang.mjs +10 -10
  37. package/dist/es/components/src/layer/layer.vue_vue_type_script_setup_true_vapor_true_lang.mjs +105 -105
  38. package/dist/es/components/src/list/index.d.ts +5 -5
  39. package/dist/es/components/src/list/list.d.ts +3 -3
  40. package/dist/es/components/src/list/list.vue_vue_type_script_setup_true_vapor_true_lang.mjs +7 -12
  41. package/dist/es/components/src/list/types.d.ts +7 -5
  42. package/dist/es/components/src/menu/menu-item.vue_vue_type_script_setup_true_vapor_true_lang.mjs +46 -37
  43. package/dist/es/components/src/menu/sub-menu.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -2
  44. package/dist/es/components/src/modal/modal.vue_vue_type_script_setup_true_vapor_true_lang.mjs +121 -121
  45. package/dist/es/components/src/panel/panel.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -2
  46. package/dist/es/components/src/popover/index.d.ts +1 -0
  47. package/dist/es/components/src/popover/popover.vue_vue_type_script_setup_true_vapor_true_lang.mjs +77 -76
  48. package/dist/es/components/src/popover/types.d.ts +4 -0
  49. package/dist/es/components/src/scrollbar/index.d.ts +7 -2
  50. package/dist/es/components/src/scrollbar/scrollbar.d.ts +5 -2
  51. package/dist/es/components/src/scrollbar/scrollbar.vue_vue_type_script_setup_true_vapor_true_lang.mjs +131 -96
  52. package/dist/es/components/src/scrollbar/types.d.ts +15 -1
  53. package/dist/es/components/src/segmented/segmented.vue_vue_type_script_setup_true_vapor_true_lang.mjs +41 -45
  54. package/dist/es/components/src/select/select.vue_vue_type_script_setup_true_vapor_true_lang.mjs +9 -9
  55. package/dist/es/components/src/table/col-group.d.ts +22 -0
  56. package/dist/es/components/src/table/col-group.vue.mjs +5 -0
  57. package/dist/es/components/src/table/col-group.vue_vue_type_script_setup_true_vapor_true_lang.mjs +25 -0
  58. package/dist/es/components/src/table/index.d.ts +18 -41
  59. package/dist/es/components/src/table/index.mjs +1 -0
  60. package/dist/es/components/src/table/table-body.d.ts +32 -0
  61. package/dist/es/components/src/table/table-body.vue.mjs +5 -0
  62. package/dist/es/components/src/table/table-body.vue_vue_type_script_setup_true_vapor_true_lang.mjs +153 -0
  63. package/dist/es/components/src/table/table-header.d.ts +23 -0
  64. package/dist/es/components/src/table/table-header.vue.mjs +5 -0
  65. package/dist/es/components/src/table/table-header.vue_vue_type_script_setup_true_vapor_true_lang.mjs +80 -0
  66. package/dist/es/components/src/table/table.d.ts +12 -25
  67. package/dist/es/components/src/table/table.vue_vue_type_script_setup_true_vapor_true_lang.mjs +167 -380
  68. package/dist/es/components/src/table/types.d.ts +61 -45
  69. package/dist/es/components/src/table/types.mjs +4 -0
  70. package/dist/es/components/src/textarea/textarea.vue_vue_type_script_setup_true_vapor_true_lang.mjs +6 -6
  71. package/dist/es/components/src/tooltip/index.d.ts +1 -0
  72. package/dist/es/components/src/tooltip/tooltip.vue_vue_type_script_setup_true_vapor_true_lang.mjs +2 -0
  73. package/dist/es/components/src/tooltip/types.d.ts +2 -0
  74. package/dist/es/components/src/transition/index.d.ts +29 -0
  75. package/dist/es/components/src/transition/index.mjs +7 -0
  76. package/dist/es/components/src/{_comp/HeightTransition.d.ts → transition/transition-height.d.ts} +0 -4
  77. package/dist/es/components/src/transition/transition-height.vue.mjs +5 -0
  78. package/dist/es/components/src/transition/transition-height.vue_vue_type_script_setup_true_vapor_true_lang.mjs +54 -0
  79. package/dist/es/components/src/transition/transition-opacity.vue.mjs +5 -0
  80. package/dist/es/components/src/{_comp/OpacityTransition.vue_vue_type_script_setup_true_vapor_true_lang.mjs → transition/transition-opacity.vue_vue_type_script_setup_true_vapor_true_lang.mjs} +2 -2
  81. package/dist/es/components/src/transition/transition-scale.vue.mjs +5 -0
  82. package/dist/es/components/src/{_comp/ScaleTransition.vue_vue_type_script_setup_true_vapor_true_lang.mjs → transition/transition-scale.vue_vue_type_script_setup_true_vapor_true_lang.mjs} +2 -2
  83. package/dist/es/components/src/transition/transition-side.vue.mjs +5 -0
  84. package/dist/es/components/src/{_comp/SideTransition.vue_vue_type_script_setup_true_vapor_true_lang.mjs → transition/transition-side.vue_vue_type_script_setup_true_vapor_true_lang.mjs} +2 -2
  85. package/dist/es/components/src/transition/transition-width.d.ts +31 -0
  86. package/dist/es/components/src/transition/transition-width.vue.mjs +5 -0
  87. package/dist/es/components/src/transition/transition-width.vue_vue_type_script_setup_true_vapor_true_lang.mjs +54 -0
  88. package/dist/es/components/src/transition/transition.d.ts +27 -0
  89. package/dist/es/components/src/transition/transition.vue.mjs +5 -0
  90. package/dist/es/components/src/transition/transition.vue_vue_type_script_setup_true_vapor_true_lang.mjs +47 -0
  91. package/dist/es/components/src/transition/types.d.ts +28 -0
  92. package/dist/es/components/src/tree/index.d.ts +15 -7
  93. package/dist/es/components/src/tree/node.d.ts +2 -1
  94. package/dist/es/components/src/tree/node.vue_vue_type_script_setup_true_vapor_true_lang.mjs +27 -29
  95. package/dist/es/components/src/tree/tree.d.ts +8 -2
  96. package/dist/es/components/src/tree/tree.vue_vue_type_script_setup_true_vapor_true_lang.mjs +69 -65
  97. package/dist/es/components/src/tree/types.d.ts +18 -12
  98. package/dist/es/core/components.mjs +94 -86
  99. package/dist/es/core/index.mjs +84 -79
  100. package/dist/es/hooks/src/use-element-size.mjs +7 -38
  101. package/dist/es/icons/index.d.ts +4 -1
  102. package/dist/es/icons/index.mjs +3 -0
  103. package/dist/es/icons/src/loading-stop.d.ts +19 -0
  104. package/dist/es/icons/src/loading-stop.vue.mjs +11 -0
  105. package/dist/es/icons/src/send.d.ts +19 -0
  106. package/dist/es/icons/src/send.vue.mjs +11 -0
  107. package/dist/es/icons/src/stop.d.ts +19 -0
  108. package/dist/es/icons/src/stop.vue.mjs +5 -0
  109. package/dist/es/theme/components/alert.scss +101 -0
  110. package/dist/es/theme/components/button.scss +21 -4
  111. package/dist/es/theme/components/cascader.scss +3 -0
  112. package/dist/es/theme/components/chat-list.scss +134 -0
  113. package/dist/es/theme/components/chat-sender.scss +123 -0
  114. package/dist/es/theme/components/index.scss +3 -0
  115. package/dist/es/theme/components/input.scss +2 -1
  116. package/dist/es/theme/components/list.scss +7 -0
  117. package/dist/es/theme/components/menu.scss +14 -1
  118. package/dist/es/theme/components/scrollbar.scss +61 -7
  119. package/dist/es/theme/components/table.scss +360 -328
  120. package/dist/es/theme/components/transition.scss +21 -21
  121. package/dist/es/theme/components/tree.scss +8 -0
  122. package/dist/es/utils/src/tool.d.ts +8 -3
  123. package/dist/es/utils/src/tool.mjs +6 -6
  124. package/dist/json/vetur-attributes.json +196 -46
  125. package/dist/json/vetur-tags.json +82 -15
  126. package/dist/json/web-types.json +432 -75
  127. package/package.json +1 -1
  128. package/dist/es/components/src/_comp/HeightTransition.vue.mjs +0 -5
  129. package/dist/es/components/src/_comp/HeightTransition.vue_vue_type_script_setup_true_vapor_true_lang.mjs +0 -77
  130. package/dist/es/components/src/_comp/OpacityTransition.vue.mjs +0 -5
  131. package/dist/es/components/src/_comp/ScaleTransition.vue.mjs +0 -5
  132. package/dist/es/components/src/_comp/SideTransition.vue.mjs +0 -5
  133. /package/dist/es/components/src/{_comp/OpacityTransition.d.ts → transition/transition-opacity.d.ts} +0 -0
  134. /package/dist/es/components/src/{_comp/ScaleTransition.d.ts → transition/transition-scale.d.ts} +0 -0
  135. /package/dist/es/components/src/{_comp/SideTransition.d.ts → transition/transition-side.d.ts} +0 -0
@@ -2,12 +2,12 @@ import { debounce as e } from "../../../utils/src/tool.mjs";
2
2
  import "../../../utils/index.mjs";
3
3
  import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
4
4
  import { useOutsideClick as n } from "../../../hooks/src/use-outside-click.mjs";
5
- import { useZIndex as r } from "../../../hooks/src/use-zIndex.mjs";
5
+ import { useZIndex as ee } from "../../../hooks/src/use-zIndex.mjs";
6
6
  import "../../../hooks/index.mjs";
7
- import { VaporTeleport as ee, VaporTransition as i, applyVShow as te, child as ne, computed as a, createComponent as o, createDynamicComponent as re, createIf as s, createSlot as c, createTemplateRefSetter as ie, defineVaporComponent as l, nextTick as u, onMounted as d, onUnmounted as ae, ref as f, renderEffect as p, setClass as m, setDynamicEvents as h, setInsertionState as g, setStyle as _, setText as oe, template as v, toDisplayString as y, unref as b, useSlots as se, useTemplateRef as x, watch as S, watchEffect as ce } from "vue";
7
+ import { VaporTeleport as te, VaporTransition as ne, applyVShow as r, child as i, computed as a, createComponent as o, createDynamicComponent as re, createIf as s, createSlot as c, createTemplateRefSetter as l, defineVaporComponent as u, nextTick as d, onMounted as ie, onUnmounted as ae, ref as f, renderEffect as p, setClass as m, setDynamicEvents as h, setInsertionState as g, setStyle as _, setText as oe, template as v, toDisplayString as se, unref as y, useSlots as b, useTemplateRef as x, watch as S, watchEffect as ce } from "vue";
8
8
  import { createPopper as le } from "@popperjs/core";
9
9
  //#region ../components/src/popover/popover.vue?vue&type=script&setup=true&vapor=true&lang.ts
10
- var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<div><div>"), C = /*@__PURE__*/ l({
10
+ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<div><div>"), C = /*@__PURE__*/ u({
11
11
  name: "SPopover",
12
12
  __name: "popover",
13
13
  props: {
@@ -21,6 +21,7 @@ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<di
21
21
  alignPoint: { type: Boolean },
22
22
  offset: {},
23
23
  arrowStyle: {},
24
+ disabled: { type: Boolean },
24
25
  destroyOnClose: {
25
26
  type: Boolean,
26
27
  default: !0
@@ -33,57 +34,57 @@ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<di
33
34
  },
34
35
  emits: ["change", "click-outside"],
35
36
  __multiRoot: !0,
36
- setup(l, { expose: v, emit: C }) {
37
- let w = l, T = C, E = t("popover"), me = se(), D = f(!1), O = f(!1), { nextZIndex: he } = r(), k = f(), A = x("containerNode"), j = x("wrapperNode"), M = x("contentNode"), N = f(null), P = () => {
37
+ setup(u, { expose: v, emit: C }) {
38
+ let w = u, T = C, E = t("popover"), me = b(), D = f(!1), O = f(!1), { nextZIndex: he } = ee(), k = f(), A = x("containerNode"), j = x("wrapperNode"), M = x("contentNode"), N = f(null), ge = () => {
38
39
  let e = me.default?.();
39
40
  return N.value = e, e;
40
- }, F = f(null), I = f({}), L = f({}), R = f({}), z = f(null), B = () => {
41
- F.value && Object.entries(L.value).forEach(([e, t]) => {
42
- F.value.removeEventListener(e, t);
41
+ }, P = f(null), F = f({}), I = f({}), L = f({}), R = f(null), z = () => {
42
+ P.value && Object.entries(I.value).forEach(([e, t]) => {
43
+ P.value.removeEventListener(e, t);
43
44
  });
44
- }, V = (e) => e == null ? [] : Array.isArray(e) ? e : [e], H = (e) => {
45
+ }, B = (e) => e == null ? [] : Array.isArray(e) ? e : [e], V = (e) => {
45
46
  if (!e) return null;
46
47
  if (e instanceof Node) return e;
47
48
  if (e.block instanceof Node) return e.block;
48
49
  if (e.el instanceof Node) return e.el;
49
50
  if (e.branches) {
50
- let t = typeof e.activeBranch == "number" ? e.activeBranch : 0, n = H(e.branches[t] || e.branches[0]);
51
+ let t = typeof e.activeBranch == "number" ? e.activeBranch : 0, n = V(e.branches[t] || e.branches[0]);
51
52
  if (n) return n;
52
53
  }
53
- for (let t of V(e.children)) {
54
- let e = H(t);
54
+ for (let t of B(e.children)) {
55
+ let e = V(t);
55
56
  if (e) return e;
56
57
  }
57
- for (let t of V(e.nodes)) {
58
+ for (let t of B(e.nodes)) {
58
59
  if (t instanceof Node) return t;
59
- let e = H(t);
60
+ let e = V(t);
60
61
  if (e) return e;
61
62
  }
62
63
  return null;
63
64
  };
64
65
  S(N, (e) => {
65
- if (!e || F.value) return;
66
+ if (!e || P.value) return;
66
67
  let t = null;
67
- t = e instanceof HTMLElement ? e : H(e), t && t !== F.value && (B(), F.value = t);
68
- }, { flush: "post" }), d(() => {
69
- if (F.value) return;
68
+ t = e instanceof HTMLElement ? e : V(e), t && t !== P.value && (z(), P.value = t);
69
+ }, { flush: "post" }), ie(() => {
70
+ if (P.value) return;
70
71
  let e = N.value;
71
72
  if (!e) return;
72
- let t = e instanceof HTMLElement ? e : H(e);
73
- t && t !== F.value && (B(), F.value = t);
74
- }), S(F, (e) => {
75
- e && u().then(() => {
76
- Object.entries(L.value).forEach(([t, n]) => {
73
+ let t = e instanceof HTMLElement ? e : V(e);
74
+ t && t !== P.value && (z(), P.value = t);
75
+ }), S(P, (e) => {
76
+ e && d().then(() => {
77
+ Object.entries(I.value).forEach(([t, n]) => {
77
78
  e.addEventListener(t, n);
78
79
  });
79
80
  });
80
81
  }, { flush: "post" });
81
- let ge = () => {
82
- if (!M.value || !F.value) return;
82
+ let _e = () => {
83
+ if (!M.value || !P.value) return;
83
84
  M.value.style.width = "";
84
85
  let e = "";
85
- typeof w.width == "number" ? (e = `${w.width}px`, M.value.style.width = e) : w.width === "sameWidth" ? (e = `${F.value.getBoundingClientRect().width}px`, M.value.style.width = e) : w.width === "auto" && (e = "", M.value.style.width = e);
86
- }, _e = a(() => {
86
+ typeof w.width == "number" ? (e = `${w.width}px`, M.value.style.width = e) : w.width === "sameWidth" ? (e = `${P.value.getBoundingClientRect().width}px`, M.value.style.width = e) : w.width === "auto" && (e = "", M.value.style.width = e);
87
+ }, ve = a(() => {
87
88
  let e = [0, 0];
88
89
  return w.offset ? e = w.offset : w.trigger === "contextmenu" && w.alignPoint ? e = [0, 0] : w.showArrow && (e = [0, 8]), {
89
90
  placement: w.placement,
@@ -109,46 +110,46 @@ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<di
109
110
  }
110
111
  ]
111
112
  };
112
- }), U = a(() => w.manual ? {
113
+ }), H = a(() => w.manual ? {
113
114
  openDelay: 0,
114
115
  closeDelay: 0
115
116
  } : {
116
117
  openDelay: typeof w.delay == "number" ? w.delay : w.delay[0],
117
118
  closeDelay: typeof w.delay == "number" ? 50 : w.delay[1]
118
- }), ve = () => {
119
- O.value = !0, u(() => {
119
+ }), U = null, ye = () => {
120
+ w.disabled || (U &&= (clearTimeout(U), null), O.value = !0, d(() => {
120
121
  D.value = !0, T("change", !0);
121
- });
122
- }, ye = () => {
123
- D.value = !1, z.value = null, T("change", !1), setTimeout(() => {
124
- w.destroyOnClose && (O.value = !1);
122
+ }));
123
+ }, be = () => {
124
+ D.value = !1, R.value = null, T("change", !1), U && clearTimeout(U), U = setTimeout(() => {
125
+ w.destroyOnClose && (O.value = !1), U = null;
125
126
  }, 300);
126
127
  }, W = f(null), G = f(null), K = () => {
127
- W.value?.cancel(), G.value?.cancel(), W.value = e(ve, U.value.openDelay), G.value = e(ye, U.value.closeDelay);
128
+ W.value?.cancel(), G.value?.cancel(), W.value = e(ye, H.value.openDelay), G.value = e(be, H.value.closeDelay);
128
129
  };
129
- K(), S(U, K);
130
+ K(), S(H, K);
130
131
  let q = () => {
131
132
  G.value?.cancel(), W.value?.();
132
133
  }, J = () => {
133
134
  W.value?.cancel(), G.value?.();
134
135
  };
135
136
  n(A, (e) => {
136
- F.value && e.target && typeof F.value.contains == "function" && F.value.contains(e.target) || (D.value && T("click-outside", e), !w.manual && (w.trigger === "hover" || w.trigger === "contextmenu" || w.trigger === "click") && J());
137
+ P.value && e.target && typeof P.value.contains == "function" && P.value.contains(e.target) || (D.value && T("click-outside", e), !w.manual && (w.trigger === "hover" || w.trigger === "contextmenu" || w.trigger === "click") && J());
137
138
  });
138
139
  let Y = null, X = () => {
139
140
  Y &&= (Y.destroy(), null);
140
141
  }, Z = () => {
141
- L.value = {}, I.value = {}, R.value = {}, Q();
142
+ I.value = {}, F.value = {}, L.value = {}, Q();
142
143
  }, Q = () => {
143
- w.manual || (w.trigger === "hover" && (L.value.mouseenter = q, L.value.mouseleave = J, I.value.mouseenter = q, I.value.mouseleave = J), w.trigger === "click" && (L.value.click = () => {
144
+ w.manual || (w.trigger === "hover" && (I.value.mouseenter = q, I.value.mouseleave = J, F.value.mouseenter = q, F.value.mouseleave = J), w.trigger === "click" && (I.value.click = () => {
144
145
  let e = D.value ? G.value : W.value;
145
146
  (D.value ? W.value : G.value)?.cancel(), e?.();
146
- }), w.trigger === "contextmenu" && (L.value.click = () => {
147
+ }), w.trigger === "contextmenu" && (I.value.click = () => {
147
148
  J();
148
- }, L.value.contextmenu = (e) => {
149
+ }, I.value.contextmenu = (e) => {
149
150
  D.value && J(), e.preventDefault();
150
151
  let t = e;
151
- z.value = {
152
+ R.value = {
152
153
  x: t.clientX,
153
154
  y: t.clientY
154
155
  }, q();
@@ -157,71 +158,71 @@ var ue = v(" "), de = v("<div data-popper-arrow>"), fe = v("<div>"), pe = v("<di
157
158
  ce(() => {
158
159
  w.manual || Q();
159
160
  });
160
- let be = () => {
161
- X();
161
+ let xe = () => {
162
+ D.value || X();
162
163
  };
163
164
  S(D, (e) => {
164
- if (!e || !j.value || !F.value) return;
165
- k.value = he(), ge();
166
- let t = F.value;
167
- w.trigger === "contextmenu" && w.alignPoint && z.value && (t = { getBoundingClientRect() {
165
+ if (!e || !j.value || !P.value) return;
166
+ k.value = he(), _e();
167
+ let t = P.value;
168
+ w.trigger === "contextmenu" && w.alignPoint && R.value && (t = { getBoundingClientRect() {
168
169
  return {
169
- top: z.value.y,
170
- left: z.value.x,
170
+ top: R.value.y,
171
+ left: R.value.x,
171
172
  width: 0,
172
173
  height: 0,
173
- right: z.value.x,
174
- bottom: z.value.y,
175
- x: z.value.x,
176
- y: z.value.y,
174
+ right: R.value.x,
175
+ bottom: R.value.y,
176
+ x: R.value.x,
177
+ y: R.value.y,
177
178
  toJSON: () => JSON.stringify({
178
- top: z.value.y,
179
- left: z.value.x,
179
+ top: R.value.y,
180
+ left: R.value.x,
180
181
  width: 0,
181
182
  height: 0,
182
- right: z.value.x,
183
- bottom: z.value.y,
184
- x: z.value.x,
185
- y: z.value.y
183
+ right: R.value.x,
184
+ bottom: R.value.y,
185
+ x: R.value.x,
186
+ y: R.value.y
186
187
  })
187
188
  };
188
- } }), X(), Y = le(t, j.value, _e.value);
189
+ } }), X(), Y = le(t, j.value, ve.value);
189
190
  }, { flush: "post" }), S(() => w.manual, (e) => {
190
191
  e ? Z() : Q();
191
192
  }), S(() => w.trigger, (e, t) => {
192
193
  e !== t && (W.value?.cancel(), D.value = !1, T("change", !1), Z());
193
194
  }), ae(() => {
194
- X(), B();
195
+ U &&= (clearTimeout(U), null), X(), z();
195
196
  }), v({
196
197
  show: q,
197
198
  hide: J
198
199
  });
199
- let $ = ie();
200
- return [re(() => P()), o(ee, {
201
- disabled: () => !l.teleportBody,
202
- to: () => l.teleport
200
+ let $ = l();
201
+ return [re(() => ge()), o(te, {
202
+ disabled: () => !u.teleportBody,
203
+ to: () => u.teleport
203
204
  }, () => s(() => O.value, () => {
204
- let e = pe(), t = ne(e);
205
+ let e = pe(), t = i(e);
205
206
  return p(() => {
206
- let n = b(E);
207
- h(e, I.value), m(e, [n.b()]), m(t, [n.e("wrapper")]), _(t, { zIndex: k.value });
208
- }), g(t, null, 0), o(i, {
207
+ let n = y(E);
208
+ h(e, F.value), m(e, [n.b()]), m(t, [n.e("wrapper")]), _(t, { zIndex: k.value });
209
+ }), g(t, null, 0), o(ne, {
209
210
  name: "popover-fade",
210
- onAfterLeave: () => be,
211
+ onAfterLeave: () => xe,
211
212
  persisted: ""
212
213
  }, () => {
213
214
  let e = fe();
214
215
  return p(() => {
215
- h(e, R.value), m(e, [b(E).e("content")]);
216
+ h(e, L.value), m(e, [y(E).e("content")]);
216
217
  }), g(e, null, 0), c("content", null, () => {
217
218
  let e = ue();
218
- return p(() => oe(e, y(l.content))), e;
219
- }), g(e, null, 1), s(() => l.showArrow, () => {
219
+ return p(() => oe(e, se(u.content))), e;
220
+ }), g(e, null, 1), s(() => u.showArrow, () => {
220
221
  let e = de();
221
222
  return p(() => {
222
- m(e, [b(E).e("arrow")]), _(e, l.arrowStyle);
223
+ m(e, [y(E).e("arrow")]), _(e, u.arrowStyle);
223
224
  }), e;
224
- }), te(e, () => D.value), $(e, M, null, "contentNode"), e;
225
+ }), r(e, () => D.value), $(e, M, null, "contentNode"), e;
225
226
  }), $(t, j, null, "wrapperNode"), $(e, A, null, "containerNode"), e;
226
227
  }, null, 129))];
227
228
  }
@@ -35,6 +35,10 @@ export interface PopoverProps {
35
35
  offset?: [number, number];
36
36
  /** 箭头样式 */
37
37
  arrowStyle?: Record<string, any>;
38
+ /** 是否禁用弹出层
39
+ * @default false
40
+ */
41
+ disabled?: boolean;
38
42
  /** 是否在关闭时销毁弹出层
39
43
  * @default false
40
44
  */
@@ -4,7 +4,7 @@ import { BackTopProps } from '../back-top';
4
4
  export declare const SScrollbar: ((__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
5
5
  attrs: any;
6
6
  slots: ScrollbarSlots;
7
- emit: {};
7
+ emit: ((evt: "scroll", e: Event) => void) & ((evt: "reachedEnd", e: Event, direction: "x" | "y") => void);
8
8
  }, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
9
9
  props: PublicProps & {
10
10
  width?: string | number | undefined;
@@ -15,13 +15,18 @@ export declare const SScrollbar: ((__VLS_props: NonNullable<Awaited<typeof __VLS
15
15
  id?: string | undefined;
16
16
  backtop?: boolean | undefined;
17
17
  backtopProps?: BackTopProps | undefined;
18
+ offsetTop?: number | undefined;
19
+ native?: boolean | undefined;
20
+ distance?: number | undefined;
21
+ onScroll?: ((e: Event) => any) | undefined;
22
+ onReachedEnd?: ((e: Event, direction: "x" | "y") => any) | undefined;
18
23
  } & (typeof globalThis extends {
19
24
  __VLS_PROPS_FALLBACK: infer P;
20
25
  } ? P : {});
21
26
  expose: (exposed: ShallowUnwrapRef<ScrollbarExpose>) => void;
22
27
  attrs: any;
23
28
  slots: ScrollbarSlots;
24
- emit: {};
29
+ emit: ((evt: "scroll", e: Event) => void) & ((evt: "reachedEnd", e: Event, direction: "x" | "y") => void);
25
30
  }>) => VNode & {
26
31
  __ctx?: Awaited<typeof __VLS_setup>;
27
32
  }) & Plugin;
@@ -1,13 +1,16 @@
1
1
  import { ScrollbarExpose, ScrollbarProps, ScrollbarSlots } from './types';
2
2
  import { PublicProps, ShallowUnwrapRef, VNode } from 'vue';
3
3
  declare const __VLS_export: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: PublicProps & __VLS_PrettifyLocal<ScrollbarProps> & (typeof globalThis extends {
4
+ props: PublicProps & __VLS_PrettifyLocal<ScrollbarProps & {
5
+ onScroll?: ((e: Event) => any) | undefined;
6
+ onReachedEnd?: ((e: Event, direction: "x" | "y") => any) | undefined;
7
+ }> & (typeof globalThis extends {
5
8
  __VLS_PROPS_FALLBACK: infer P;
6
9
  } ? P : {});
7
10
  expose: (exposed: ShallowUnwrapRef<ScrollbarExpose>) => void;
8
11
  attrs: any;
9
12
  slots: ScrollbarSlots;
10
- emit: {};
13
+ emit: ((evt: "scroll", e: Event) => void) & ((evt: "reachedEnd", e: Event, direction: "x" | "y") => void);
11
14
  }>) => VNode & {
12
15
  __ctx?: Awaited<typeof __VLS_setup>;
13
16
  };
@@ -3,11 +3,11 @@ import "../../../utils/index.mjs";
3
3
  import { useNamespace as t } from "../../../hooks/src/use-namespace.mjs";
4
4
  import "../../../hooks/index.mjs";
5
5
  import { SBackTop as n } from "../back-top/index.mjs";
6
- import { applyVShow as r, child as i, createComponent as a, createIf as o, createInvoker as s, createSlot as c, createTemplateRefSetter as ee, defineVaporComponent as l, delegateEvents as u, next as d, nextTick as f, on as te, onMounted as ne, onUnmounted as re, ref as p, renderEffect as ie, setClass as m, setInsertionState as h, setProp as ae, setStyle as g, template as _, unref as v, useId as oe, watch as se } from "vue";
6
+ import { applyVShow as r, child as i, createComponent as a, createIf as o, createInvoker as s, createSlot as c, createTemplateRefSetter as l, defineVaporComponent as u, delegateEvents as d, nextTick as ee, on as f, onMounted as p, onUnmounted as te, ref as m, renderEffect as h, setClass as g, setInsertionState as _, setProp as v, setStyle as y, template as b, unref as x, useId as ne, watch as re } from "vue";
7
7
  //#region ../components/src/scrollbar/scrollbar.vue?vue&type=script&setup=true&vapor=true&lang.ts
8
- var ce = _("<div><div></div><!><div><div><div></div></div></div><div><div><div>", 1);
9
- u("mousedown");
10
- var y = /*@__PURE__*/ l({
8
+ var S = b("<div>"), ie = b("<div><div><div></div></div></div>"), C = b("<div><div><div>"), w = b("<div>", 1);
9
+ d("mousedown");
10
+ var T = /*@__PURE__*/ u({
11
11
  name: "SScrollbar",
12
12
  __name: "scrollbar",
13
13
  props: {
@@ -18,128 +18,163 @@ var y = /*@__PURE__*/ l({
18
18
  always: { type: Boolean },
19
19
  id: {},
20
20
  backtop: { type: Boolean },
21
- backtopProps: {}
21
+ backtopProps: {},
22
+ offsetTop: { default: 0 },
23
+ native: { type: Boolean },
24
+ distance: { default: 0 }
22
25
  },
23
- setup(l, { expose: u }) {
24
- let _ = l, y = t("scrollbar"), b = "scrollbar_" + oe(), x = p(null), S = p(null), C = p(null), w = p(!1), T = p(0), E = p(20), D = p(!1), O = p(0), k = p(20), A = p(!1), j = p(""), M = 0, N = 0, P = null, F = () => {
25
- P && clearTimeout(P), P = window.setTimeout(() => {
26
- I();
26
+ emits: ["scroll", "reachedEnd"],
27
+ setup(u, { expose: d, emit: b }) {
28
+ let T = u, E = b, D = t("scrollbar"), O = "scrollbar_" + ne(), k = m(null), A = m(null), j = m(null), M = m(!1), N = m(0), P = m(20), F = m(!1), I = m(0), L = m(20), R = m(!1), z = m(""), B = 0, V = 0, H = null, U = () => {
29
+ H && clearTimeout(H), H = window.setTimeout(() => {
30
+ W();
27
31
  }, 10);
28
- }, I = () => {
29
- let e = x.value;
32
+ }, W = () => {
33
+ let e = k.value;
30
34
  if (!e) return;
31
35
  e.offsetHeight;
32
- let { clientWidth: t, clientHeight: n, scrollWidth: r, scrollHeight: i } = e;
33
- if (w.value = i > n + 1, w.value) {
36
+ let { clientWidth: t, clientHeight: n, scrollWidth: r, scrollHeight: i } = e, a = n - T.offsetTop;
37
+ if (M.value = i > n + 1, M.value) {
34
38
  let e = n / i;
35
- E.value = Math.max(20, e * n), T.value = 0;
36
- } else T.value = 0;
37
- if (D.value = r > t + 1, D.value) {
39
+ P.value = Math.max(20, e * a);
40
+ }
41
+ if (F.value = r > t + 1, F.value) {
38
42
  let e = t / r;
39
- k.value = Math.max(20, e * t), O.value = 0;
40
- } else O.value = 0;
41
- L();
42
- }, L = () => {
43
- let e = x.value;
43
+ L.value = Math.max(20, e * t);
44
+ }
45
+ G();
46
+ }, ae = (e) => {
47
+ G(), E("scroll", e), oe(e);
48
+ }, oe = (e) => {
49
+ let t = k.value;
50
+ if (!t) return;
51
+ let { scrollTop: n, scrollLeft: r, clientWidth: i, clientHeight: a, scrollWidth: o, scrollHeight: s } = t, c = T.distance;
52
+ M.value && n + a >= s - c && E("reachedEnd", e, "y"), F.value && r + i >= o - c && E("reachedEnd", e, "x");
53
+ }, G = () => {
54
+ let e = k.value;
44
55
  if (!e) return;
45
- let { scrollTop: t, scrollLeft: n, clientWidth: r, clientHeight: i, scrollWidth: a, scrollHeight: o } = e;
46
- if (w.value) {
56
+ let { scrollTop: t, scrollLeft: n, clientWidth: r, clientHeight: i, scrollWidth: a, scrollHeight: o } = e, s = i - T.offsetTop;
57
+ if (M.value) {
47
58
  let e = o - i;
48
- T.value = (e <= 0 ? 0 : t / e) * (i - E.value);
59
+ N.value = (e <= 0 ? 0 : t / e) * (s - P.value);
49
60
  }
50
- if (D.value) {
61
+ if (F.value) {
51
62
  let e = a - r;
52
- O.value = (e <= 0 ? 0 : n / e) * (r - k.value);
63
+ I.value = (e <= 0 ? 0 : n / e) * (r - L.value);
53
64
  }
54
- }, R = (e, t) => {
55
- x.value && (t === "y" && !S.value || t === "x" && !C.value || (A.value = !0, j.value = t, M = t === "y" ? e.clientY : e.clientX, N = t === "y" ? T.value : O.value, e.preventDefault(), e.stopPropagation()));
56
- }, z = (e) => {
57
- if (!A.value || !j.value || !x.value) return;
58
- let t = x.value, n = j.value === "y" ? e.clientY - M : e.clientX - M;
59
- if (j.value === "y") {
60
- let e = t.clientHeight - E.value, r = Math.max(0, Math.min(e, N + n));
61
- T.value = r, t.scrollTop = (e <= 0 ? 0 : r / e) * (t.scrollHeight - t.clientHeight);
65
+ }, K = (e, t) => {
66
+ k.value && (t === "y" && !A.value || t === "x" && !j.value || (R.value = !0, z.value = t, B = t === "y" ? e.clientY : e.clientX, V = t === "y" ? N.value : I.value, e.preventDefault(), e.stopPropagation()));
67
+ }, q = (e) => {
68
+ if (!R.value || !z.value || !k.value) return;
69
+ let t = k.value, n = z.value === "y" ? e.clientY - B : e.clientX - B;
70
+ if (z.value === "y") {
71
+ let e = t.clientHeight - T.offsetTop - P.value, r = Math.max(0, Math.min(e, V + n));
72
+ N.value = r, t.scrollTop = (e <= 0 ? 0 : r / e) * (t.scrollHeight - t.clientHeight);
62
73
  }
63
- if (j.value === "x") {
64
- let e = t.clientWidth - k.value, r = Math.max(0, Math.min(e, N + n));
65
- O.value = r, t.scrollLeft = (e <= 0 ? 0 : r / e) * (t.scrollWidth - t.clientWidth);
74
+ if (z.value === "x") {
75
+ let e = t.clientWidth - L.value, r = Math.max(0, Math.min(e, V + n));
76
+ I.value = r, t.scrollLeft = (e <= 0 ? 0 : r / e) * (t.scrollWidth - t.clientWidth);
66
77
  }
67
- }, B = () => {
68
- A.value = !1, j.value = "";
69
- }, V = p(null), H = p(null);
70
- ne(() => {
71
- f(() => {
72
- I(), F();
78
+ }, J = () => {
79
+ R.value = !1, z.value = "";
80
+ }, Y = m(null), X = m(null);
81
+ p(() => {
82
+ ee(() => {
83
+ W(), U();
73
84
  });
74
- let e = x.value?.parentElement;
75
- e && (V.value = new ResizeObserver(() => {
76
- requestAnimationFrame(F);
77
- }), V.value.observe(e)), x.value && (H.value = new MutationObserver(() => {
78
- requestAnimationFrame(F);
79
- }), H.value.observe(x.value, {
85
+ let e = k.value?.parentElement;
86
+ e && (Y.value = new ResizeObserver(() => {
87
+ requestAnimationFrame(U);
88
+ }), Y.value.observe(e)), k.value && (X.value = new MutationObserver(() => {
89
+ requestAnimationFrame(U);
90
+ }), X.value.observe(k.value, {
80
91
  childList: !0,
81
92
  subtree: !0,
82
93
  attributes: !0
83
- })), document.addEventListener("mousemove", z), document.addEventListener("mouseup", B);
84
- }), re(() => {
85
- P && clearTimeout(P), V.value?.disconnect(), H.value?.disconnect(), document.removeEventListener("mousemove", z), document.removeEventListener("mouseup", B);
86
- }), se([
87
- () => _.width,
88
- () => _.height,
89
- () => _.maxHeight,
90
- () => _.padding
91
- ], F);
92
- let U = (e = 0, t = 0, n = !1) => {
93
- let r = x.value;
94
+ })), document.addEventListener("mousemove", q), document.addEventListener("mouseup", J);
95
+ }), te(() => {
96
+ H && clearTimeout(H), Y.value?.disconnect(), X.value?.disconnect(), document.removeEventListener("mousemove", q), document.removeEventListener("mouseup", J);
97
+ }), re([
98
+ () => T.width,
99
+ () => T.height,
100
+ () => T.maxHeight,
101
+ () => T.padding,
102
+ () => T.offsetTop
103
+ ], U);
104
+ let Z = (e = 0, t = 0, n = !1) => {
105
+ let r = k.value;
94
106
  if (!r) return;
95
107
  let i = Math.max(0, r.scrollHeight - r.clientHeight), a = Math.max(0, r.scrollWidth - r.clientWidth);
96
108
  r.scrollTo({
97
109
  top: Math.min(e, i),
98
110
  left: Math.min(t, a),
99
111
  behavior: n ? "smooth" : "auto"
100
- }), f(L);
112
+ }), G(), requestAnimationFrame(G);
101
113
  };
102
- u({
103
- scrollTo: U,
114
+ d({
115
+ scrollTo: Z,
104
116
  scrollToEl: (e, t = !0) => {
105
- let n = x.value;
117
+ let n = k.value;
106
118
  if (!n) return;
107
119
  let r = n.querySelector(`#${e}`);
108
- r && U(r.offsetTop, 0, t);
120
+ r && Z(r.offsetTop, 0, t);
121
+ },
122
+ scrollToEnd: (e = "y", t = !0) => {
123
+ let n = k.value;
124
+ n && (e === "y" ? Z(n.scrollHeight, 0, t) : Z(0, n.scrollWidth, t));
109
125
  }
110
126
  });
111
- let W = ee(), G = ce(), K = i(G), q = d(K, 1), J = d(q, 2), Y = i(J), X = i(Y), Z = d(J, 3), Q = i(Z), $ = i(Q);
112
- return ie(() => {
113
- let t = v(y), n = v(e);
114
- m(G, [t.b()]), g(G, {
115
- width: n(l.width),
116
- height: n(l.height)
117
- }), m(K, [t.e("content")]), g(K, {
118
- padding: l.padding,
119
- maxHeight: n(l.maxHeight)
120
- }), ae(K, "id", l.id || b);
121
- }), h(K, null, 0), c(), te(K, "scroll", L), W(K, x, null, "contentRef"), h(G, q, 1), o(() => l.backtop, () => a(v(n), {
122
- target: () => `#${l.id || b}`,
123
- $: [() => l.backtopProps]
124
- }, () => c("backtop", null, null, 4))), W(X, S, null, "thumbYRef"), r(J, () => w.value), J.$evtmousedown = s((e) => R(e, "y")), W($, C, null, "thumbXRef"), r(Z, () => D.value), Z.$evtmousedown = s((e) => R(e, "x")), ie(() => {
125
- let e = v(y), t = [e.e("track")], n = [e.e("thumb")];
126
- m(J, [
127
- e.e("scroll-bar"),
128
- e.e("y"),
129
- { [e.m("always")]: l.always }
130
- ]), m(Y, t), m(X, n), g(X, {
131
- top: T.value + "px",
132
- height: E.value + "px"
133
- }), m(Z, [
134
- e.e("scroll-bar"),
135
- e.e("x"),
136
- { [e.m("always")]: l.always }
137
- ]), m(Q, t), m($, n), g($, {
138
- left: O.value + "px",
139
- width: k.value + "px"
127
+ let Q = l(), $ = w();
128
+ return h(() => {
129
+ let t = x(D), n = x(e);
130
+ g($, [t.b(), t.is("dragging", R.value)]), y($, {
131
+ width: n(u.width),
132
+ height: n(u.height)
140
133
  });
141
- }), G;
134
+ }), _($, null, 0), o(() => u.native, () => {
135
+ let t = S();
136
+ return h(() => {
137
+ g(t, [x(D).e("content")]), y(t, {
138
+ padding: u.padding,
139
+ maxHeight: x(e)(u.maxHeight)
140
+ }), v(t, "id", u.id || O);
141
+ }), _(t, null, 0), c(), t;
142
+ }, () => {
143
+ let t = S();
144
+ return h(() => {
145
+ g(t, [x(D).e("scroll-content")]), y(t, {
146
+ padding: u.padding,
147
+ maxHeight: x(e)(u.maxHeight)
148
+ }), v(t, "id", u.id || O);
149
+ }), _(t, null, 0), c(), f(t, "scroll", ae), Q(t, k, null, "contentRef"), t;
150
+ }, 261), _($, null, 1), o(() => u.backtop, () => a(x(n), {
151
+ target: () => `#${u.id || O}`,
152
+ $: [() => u.backtopProps]
153
+ }, () => c("backtop", null, null, 4))), _($, null, 2), o(() => !u.native, () => {
154
+ let e = ie(), t = i(e), n = i(t), a = C(), o = i(a), c = i(o);
155
+ return Q(n, A, null, "thumbYRef"), r(e, () => M.value), e.$evtmousedown = s((e) => K(e, "y")), Q(c, j, null, "thumbXRef"), r(a, () => F.value), a.$evtmousedown = s((e) => K(e, "x")), h(() => {
156
+ let r = x(D), i = u.offsetTop, s = [r.e("track")], l = [r.e("thumb")];
157
+ g(e, [
158
+ r.e("scroll-bar"),
159
+ r.e("y"),
160
+ { [r.m("always")]: u.always }
161
+ ]), y(e, {
162
+ top: i ? i + "px" : void 0,
163
+ height: i ? `calc(100% - ${i}px)` : void 0
164
+ }), g(t, s), g(n, l), y(n, {
165
+ top: N.value + "px",
166
+ height: P.value + "px"
167
+ }), g(a, [
168
+ r.e("scroll-bar"),
169
+ r.e("x"),
170
+ { [r.m("always")]: u.always }
171
+ ]), g(o, s), g(c, l), y(c, {
172
+ left: I.value + "px",
173
+ width: L.value + "px"
174
+ });
175
+ }), [e, a];
176
+ }, null, 2), $;
142
177
  }
143
178
  });
144
179
  //#endregion
145
- export { y as default };
180
+ export { T as default };
@@ -16,6 +16,12 @@ export interface ScrollbarProps {
16
16
  backtop?: boolean;
17
17
  /** 返回顶部按钮属性 */
18
18
  backtopProps?: BackTopProps;
19
+ /** 竖向滚动条距顶部偏移 */
20
+ offsetTop?: number;
21
+ /** 是否使用原生滚动条 */
22
+ native?: boolean;
23
+ /** 到达滚动条末尾距离 */
24
+ distance?: number;
19
25
  }
20
26
  export interface ScrollbarSlots {
21
27
  /** 默认 */
@@ -23,9 +29,17 @@ export interface ScrollbarSlots {
23
29
  /** 返回顶部按钮 */
24
30
  backtop?: () => any;
25
31
  }
32
+ export interface ScrollbarEmits {
33
+ /** 滚动事件 */
34
+ scroll: [e: Event];
35
+ /** 到达滚动条末尾事件 */
36
+ reachedEnd: [e: Event, direction: "x" | "y"];
37
+ }
26
38
  export interface ScrollbarExpose {
27
39
  /** 滚动到指定位置 */
28
- scrollTo: (top: number, left: number, smooth?: boolean) => void;
40
+ scrollTo: (top: number, left?: number, smooth?: boolean) => void;
29
41
  /** 滚动到指定元素 */
30
42
  scrollToEl: (id: string, smooth?: boolean) => void;
43
+ /** 滚动到底部或最右边 */
44
+ scrollToEnd: (direction?: "y" | "x", smooth?: boolean) => void;
31
45
  }