@king-one/antdv 1.0.22 → 1.0.24

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 (217) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/components/base/style/index.mjs +1 -2
  3. package/dist/es/components/collapse-transtion/hooks/use-collapse-transtion.mjs +43 -110
  4. package/dist/es/components/collapse-transtion/index.mjs +11 -10
  5. package/dist/es/components/collapse-transtion/src/collapse-transtion.vue.mjs +4 -6
  6. package/dist/es/components/collapse-transtion/src/collapse-transtion.vue2.mjs +21 -27
  7. package/dist/es/components/collapse-transtion/src/types.mjs +5 -5
  8. package/dist/es/components/collapse-transtion/style/index.mjs +2 -3
  9. package/dist/es/components/form/component/form.mjs +4 -4
  10. package/dist/es/components/form/component/form.vue.mjs +4 -6
  11. package/dist/es/components/form/component/form.vue2.mjs +14 -19
  12. package/dist/es/components/form/index.mjs +10 -9
  13. package/dist/es/components/index.mjs +14 -10
  14. package/dist/es/components/pro-dialog/hooks/useProDialog.mjs +27 -42
  15. package/dist/es/components/pro-dialog/index.mjs +12 -11
  16. package/dist/es/components/pro-dialog/src/pro-dialog.vue.mjs +4 -6
  17. package/dist/es/components/pro-dialog/src/pro-dialog.vue2.mjs +18 -35
  18. package/dist/es/components/pro-dialog/src/types.mjs +6 -7
  19. package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue.mjs +4 -0
  20. package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue2.mjs +63 -0
  21. package/dist/es/components/scale-virtual-list/component/types.mjs +1 -0
  22. package/dist/es/components/scale-virtual-list/hooks/useVirtualList.mjs +156 -0
  23. package/dist/es/components/scale-virtual-list/index.mjs +10 -0
  24. package/dist/es/components/scale-virtual-list/style/index.mjs +2 -0
  25. package/dist/es/components/scroll-bar/index.mjs +9 -9
  26. package/dist/es/components/scroll-bar/src/scroll-bar.mjs +141 -358
  27. package/dist/es/components/scroll-bar/src/types.mjs +4 -4
  28. package/dist/es/components/utils/install.mjs +14 -14
  29. package/dist/es/components/virtual-list/index.mjs +10 -9
  30. package/dist/es/components/virtual-list/src/types.mjs +5 -5
  31. package/dist/es/components/virtual-list/src/virtual-list.vue.mjs +4 -6
  32. package/dist/es/components/virtual-list/src/virtual-list.vue2.mjs +74 -87
  33. package/dist/es/hooks/use-namespace/index.mjs +43 -72
  34. package/dist/es/index.mjs +30 -16
  35. package/dist/es/installer.mjs +12 -12
  36. package/dist/lib/components/base/style/index.js +1 -5
  37. package/dist/lib/components/collapse-transtion/hooks/use-collapse-transtion.js +1 -136
  38. package/dist/lib/components/collapse-transtion/index.js +1 -16
  39. package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue.js +1 -10
  40. package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue2.js +1 -34
  41. package/dist/lib/components/collapse-transtion/src/types.js +1 -11
  42. package/dist/lib/components/collapse-transtion/style/index.js +1 -6
  43. package/dist/lib/components/form/component/form.js +1 -13
  44. package/dist/lib/components/form/component/form.vue.js +1 -10
  45. package/dist/lib/components/form/component/form.vue2.js +1 -30
  46. package/dist/lib/components/form/index.js +1 -15
  47. package/dist/lib/components/index.js +1 -25
  48. package/dist/lib/components/pro-dialog/hooks/useProDialog.js +1 -52
  49. package/dist/lib/components/pro-dialog/index.js +1 -19
  50. package/dist/lib/components/pro-dialog/src/pro-dialog.vue.js +1 -10
  51. package/dist/lib/components/pro-dialog/src/pro-dialog.vue2.js +1 -42
  52. package/dist/lib/components/pro-dialog/src/types.js +1 -11
  53. package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue.js +1 -0
  54. package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue2.js +1 -0
  55. package/dist/lib/components/scale-virtual-list/component/types.js +1 -0
  56. package/dist/lib/components/scale-virtual-list/hooks/useVirtualList.js +1 -0
  57. package/dist/lib/components/scale-virtual-list/index.js +1 -0
  58. package/dist/lib/components/scale-virtual-list/style/index.js +1 -0
  59. package/dist/lib/components/scroll-bar/index.js +1 -15
  60. package/dist/lib/components/scroll-bar/src/scroll-bar.js +1 -390
  61. package/dist/lib/components/scroll-bar/src/types.js +1 -11
  62. package/dist/lib/components/utils/install.js +1 -22
  63. package/dist/lib/components/virtual-list/index.js +1 -15
  64. package/dist/lib/components/virtual-list/src/types.js +1 -32
  65. package/dist/lib/components/virtual-list/src/virtual-list.vue.js +1 -10
  66. package/dist/lib/components/virtual-list/src/virtual-list.vue2.js +1 -104
  67. package/dist/lib/hooks/use-namespace/index.js +1 -83
  68. package/dist/lib/index.js +1 -30
  69. package/dist/lib/installer.js +1 -19
  70. package/dist/theme-chalk/index.css +1 -1
  71. package/dist/theme-chalk/scale-virtual-list.css +1 -0
  72. package/dist/{es → types}/components/collapse-transtion/hooks/use-collapse-transtion.d.ts +2 -2
  73. package/dist/types/components/collapse-transtion/index.d.ts +41 -0
  74. package/dist/types/components/collapse-transtion/src/collapse-transtion.vue.d.ts +27 -0
  75. package/dist/{es → types}/components/collapse-transtion/src/types.d.ts +1 -1
  76. package/dist/{lib → types}/components/form/component/form.d.ts +2 -2
  77. package/dist/types/components/form/component/form.vue.d.ts +32 -0
  78. package/dist/types/components/form/index.d.ts +50 -0
  79. package/dist/{lib → types}/components/index.d.ts +2 -0
  80. package/dist/{lib → types}/components/pro-dialog/hooks/useProDialog.d.ts +2 -1
  81. package/dist/types/components/pro-dialog/index.d.ts +26 -0
  82. package/dist/types/components/pro-dialog/src/pro-dialog.vue.d.ts +24 -0
  83. package/dist/types/components/pro-dialog/src/types.d.ts +7 -0
  84. package/dist/types/components/scale-virtual-list/component/scale-virtual-list.vue.d.ts +28 -0
  85. package/dist/types/components/scale-virtual-list/component/types.d.ts +11 -0
  86. package/dist/types/components/scale-virtual-list/hooks/useVirtualList.d.ts +70 -0
  87. package/dist/types/components/scale-virtual-list/index.d.ts +67 -0
  88. package/dist/types/components/scroll-bar/index.d.ts +36 -0
  89. package/dist/types/components/scroll-bar/src/scroll-bar.d.ts +34 -0
  90. package/dist/{es → types}/components/scroll-bar/src/types.d.ts +1 -1
  91. package/dist/{lib → types}/components/utils/install.d.ts +1 -1
  92. package/dist/types/components/utils/tool.d.ts +1 -0
  93. package/dist/types/components/virtual-list/index.d.ts +163 -0
  94. package/dist/{es → types}/components/virtual-list/src/types.d.ts +2 -2
  95. package/dist/types/components/virtual-list/src/virtual-list.vue.d.ts +364 -0
  96. package/dist/{es → types}/index.d.ts +1 -1
  97. package/dist/{lib → types}/installer.d.ts +1 -1
  98. package/package.json +8 -3
  99. package/dist/cdn/index.cdn.js +0 -16
  100. package/dist/cdn/index.cdn.js.map +0 -1
  101. package/dist/cdn/index.cdn.mjs +0 -16
  102. package/dist/cdn/index.cdn.mjs.map +0 -1
  103. package/dist/cdn/index.css +0 -1
  104. package/dist/es/components/base/style/index.mjs.map +0 -1
  105. package/dist/es/components/collapse-transtion/hooks/use-collapse-transtion.mjs.map +0 -1
  106. package/dist/es/components/collapse-transtion/index.d.ts +0 -29
  107. package/dist/es/components/collapse-transtion/index.mjs.map +0 -1
  108. package/dist/es/components/collapse-transtion/src/collapse-transtion.vue.d.ts +0 -27
  109. package/dist/es/components/collapse-transtion/src/collapse-transtion.vue.mjs.map +0 -1
  110. package/dist/es/components/collapse-transtion/src/collapse-transtion.vue2.mjs.map +0 -1
  111. package/dist/es/components/collapse-transtion/src/types.mjs.map +0 -1
  112. package/dist/es/components/collapse-transtion/style/index.mjs.map +0 -1
  113. package/dist/es/components/form/component/form.d.ts +0 -10
  114. package/dist/es/components/form/component/form.mjs.map +0 -1
  115. package/dist/es/components/form/component/form.vue.d.ts +0 -16
  116. package/dist/es/components/form/component/form.vue.mjs.map +0 -1
  117. package/dist/es/components/form/component/form.vue2.mjs.map +0 -1
  118. package/dist/es/components/form/index.d.ts +0 -17
  119. package/dist/es/components/form/index.mjs.map +0 -1
  120. package/dist/es/components/form-item/component/form-item.vue.d.ts +0 -24
  121. package/dist/es/components/form-item/component/form-item.vue.mjs +0 -6
  122. package/dist/es/components/form-item/component/form-item.vue.mjs.map +0 -1
  123. package/dist/es/components/form-item/component/form-item.vue2.mjs +0 -128
  124. package/dist/es/components/form-item/component/form-item.vue2.mjs.map +0 -1
  125. package/dist/es/components/form-item/index.d.ts +0 -0
  126. package/dist/es/components/form-item/index.mjs +0 -2
  127. package/dist/es/components/form-item/index.mjs.map +0 -1
  128. package/dist/es/components/index.d.ts +0 -4
  129. package/dist/es/components/index.mjs.map +0 -1
  130. package/dist/es/components/pro-dialog/hooks/useProDialog.d.ts +0 -13
  131. package/dist/es/components/pro-dialog/hooks/useProDialog.mjs.map +0 -1
  132. package/dist/es/components/pro-dialog/index.d.ts +0 -1542
  133. package/dist/es/components/pro-dialog/index.mjs.map +0 -1
  134. package/dist/es/components/pro-dialog/src/pro-dialog.vue.d.ts +0 -1539
  135. package/dist/es/components/pro-dialog/src/pro-dialog.vue.mjs.map +0 -1
  136. package/dist/es/components/pro-dialog/src/pro-dialog.vue2.mjs.map +0 -1
  137. package/dist/es/components/pro-dialog/src/types.d.ts +0 -6
  138. package/dist/es/components/pro-dialog/src/types.mjs.map +0 -1
  139. package/dist/es/components/pro-dialog/style/index.mjs +0 -3
  140. package/dist/es/components/pro-dialog/style/index.mjs.map +0 -1
  141. package/dist/es/components/scroll-bar/index.d.ts +0 -35
  142. package/dist/es/components/scroll-bar/index.mjs.map +0 -1
  143. package/dist/es/components/scroll-bar/src/scroll-bar.d.ts +0 -33
  144. package/dist/es/components/scroll-bar/src/scroll-bar.mjs.map +0 -1
  145. package/dist/es/components/scroll-bar/src/types.mjs.map +0 -1
  146. package/dist/es/components/scroll-bar/style/index.mjs +0 -3
  147. package/dist/es/components/scroll-bar/style/index.mjs.map +0 -1
  148. package/dist/es/components/utils/install.d.ts +0 -7
  149. package/dist/es/components/utils/install.mjs.map +0 -1
  150. package/dist/es/components/virtual-list/index.d.ts +0 -312
  151. package/dist/es/components/virtual-list/index.mjs.map +0 -1
  152. package/dist/es/components/virtual-list/src/types.mjs.map +0 -1
  153. package/dist/es/components/virtual-list/src/virtual-list.vue.d.ts +0 -312
  154. package/dist/es/components/virtual-list/src/virtual-list.vue.mjs.map +0 -1
  155. package/dist/es/components/virtual-list/src/virtual-list.vue2.mjs.map +0 -1
  156. package/dist/es/hooks/use-namespace/index.d.ts +0 -23
  157. package/dist/es/hooks/use-namespace/index.mjs.map +0 -1
  158. package/dist/es/index.mjs.map +0 -1
  159. package/dist/es/installer.d.ts +0 -6
  160. package/dist/es/installer.mjs.map +0 -1
  161. package/dist/lib/components/base/style/index.js.map +0 -1
  162. package/dist/lib/components/collapse-transtion/hooks/use-collapse-transtion.d.ts +0 -12
  163. package/dist/lib/components/collapse-transtion/hooks/use-collapse-transtion.js.map +0 -1
  164. package/dist/lib/components/collapse-transtion/index.d.ts +0 -29
  165. package/dist/lib/components/collapse-transtion/index.js.map +0 -1
  166. package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue.d.ts +0 -27
  167. package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue.js.map +0 -1
  168. package/dist/lib/components/collapse-transtion/src/collapse-transtion.vue2.js.map +0 -1
  169. package/dist/lib/components/collapse-transtion/src/types.d.ts +0 -8
  170. package/dist/lib/components/collapse-transtion/src/types.js.map +0 -1
  171. package/dist/lib/components/collapse-transtion/style/index.js.map +0 -1
  172. package/dist/lib/components/form/component/form.js.map +0 -1
  173. package/dist/lib/components/form/component/form.vue.d.ts +0 -16
  174. package/dist/lib/components/form/component/form.vue.js.map +0 -1
  175. package/dist/lib/components/form/component/form.vue2.js.map +0 -1
  176. package/dist/lib/components/form/index.d.ts +0 -17
  177. package/dist/lib/components/form/index.js.map +0 -1
  178. package/dist/lib/components/form-item/component/form-item.vue.d.ts +0 -24
  179. package/dist/lib/components/form-item/component/form-item.vue.js +0 -10
  180. package/dist/lib/components/form-item/component/form-item.vue.js.map +0 -1
  181. package/dist/lib/components/form-item/component/form-item.vue2.js +0 -132
  182. package/dist/lib/components/form-item/component/form-item.vue2.js.map +0 -1
  183. package/dist/lib/components/form-item/index.d.ts +0 -0
  184. package/dist/lib/components/form-item/index.js +0 -3
  185. package/dist/lib/components/form-item/index.js.map +0 -1
  186. package/dist/lib/components/index.js.map +0 -1
  187. package/dist/lib/components/pro-dialog/hooks/useProDialog.js.map +0 -1
  188. package/dist/lib/components/pro-dialog/index.d.ts +0 -1542
  189. package/dist/lib/components/pro-dialog/index.js.map +0 -1
  190. package/dist/lib/components/pro-dialog/src/pro-dialog.vue.d.ts +0 -1539
  191. package/dist/lib/components/pro-dialog/src/pro-dialog.vue.js.map +0 -1
  192. package/dist/lib/components/pro-dialog/src/pro-dialog.vue2.js.map +0 -1
  193. package/dist/lib/components/pro-dialog/src/types.d.ts +0 -6
  194. package/dist/lib/components/pro-dialog/src/types.js.map +0 -1
  195. package/dist/lib/components/pro-dialog/style/index.js +0 -6
  196. package/dist/lib/components/pro-dialog/style/index.js.map +0 -1
  197. package/dist/lib/components/scroll-bar/index.d.ts +0 -35
  198. package/dist/lib/components/scroll-bar/index.js.map +0 -1
  199. package/dist/lib/components/scroll-bar/src/scroll-bar.d.ts +0 -33
  200. package/dist/lib/components/scroll-bar/src/scroll-bar.js.map +0 -1
  201. package/dist/lib/components/scroll-bar/src/types.d.ts +0 -7
  202. package/dist/lib/components/scroll-bar/src/types.js.map +0 -1
  203. package/dist/lib/components/scroll-bar/style/index.js +0 -6
  204. package/dist/lib/components/scroll-bar/style/index.js.map +0 -1
  205. package/dist/lib/components/utils/install.js.map +0 -1
  206. package/dist/lib/components/virtual-list/index.d.ts +0 -312
  207. package/dist/lib/components/virtual-list/index.js.map +0 -1
  208. package/dist/lib/components/virtual-list/src/types.d.ts +0 -39
  209. package/dist/lib/components/virtual-list/src/types.js.map +0 -1
  210. package/dist/lib/components/virtual-list/src/virtual-list.vue.d.ts +0 -312
  211. package/dist/lib/components/virtual-list/src/virtual-list.vue.js.map +0 -1
  212. package/dist/lib/components/virtual-list/src/virtual-list.vue2.js.map +0 -1
  213. package/dist/lib/hooks/use-namespace/index.d.ts +0 -23
  214. package/dist/lib/hooks/use-namespace/index.js.map +0 -1
  215. package/dist/lib/index.d.ts +0 -3
  216. package/dist/lib/index.js.map +0 -1
  217. package/dist/lib/installer.js.map +0 -1
@@ -1,386 +1,169 @@
1
- import { isVNode, defineComponent, onMounted, ref, computed, createVNode, mergeProps } from 'vue';
2
- import { VResizeObserver } from 'vueuc';
3
- import { off, on } from 'evtd';
4
- import { defaultNamespace } from '../../../hooks/use-namespace/index.mjs';
5
- import { scrollbarProps } from './types.mjs';
6
-
7
- function _isSlot(s) {
8
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
9
- }
10
- var ScrollBar = /* @__PURE__ */ defineComponent({
1
+ import { defineComponent as ae, onMounted as ce, ref as a, computed as c } from "vue";
2
+ import { VResizeObserver as j } from "vueuc";
3
+ import { off as g, on as z } from "evtd";
4
+ import { defaultNamespace as u } from "../../../hooks/use-namespace/index.mjs";
5
+ import { scrollbarProps as ie } from "./types.mjs";
6
+ const ve = ae({
11
7
  name: "KScrollbar",
12
- props: scrollbarProps,
13
- inheritAttrs: false,
14
- setup(props) {
15
- onMounted(() => {
16
- if (props.container) return;
17
- sync();
8
+ props: ie,
9
+ inheritAttrs: !1,
10
+ setup(l) {
11
+ ce(() => {
12
+ l.container || d();
18
13
  });
19
- const handleContentResize = () => {
20
- sync();
21
- };
22
- const handleContainerResize = () => {
23
- sync();
24
- };
25
- const contentRef = ref(null);
26
- const containerRef = ref(null);
27
- const yRailRef = ref(null);
28
- const xRailRef = ref(null);
29
- const contentHeightRef = ref(null);
30
- const contentWidthRef = ref(null);
31
- const containerHeightRef = ref(null);
32
- const containerWidthRef = ref(null);
33
- const yRailSizeRef = ref(null);
34
- const xRailSizeRef = ref(null);
35
- const mergedContentRef = computed(() => {
36
- var _a;
37
- return ((_a = props.content) == null ? void 0 : _a.call(props)) || contentRef.value;
38
- });
39
- const mergedContainerRef = computed(() => {
40
- var _a;
41
- return ((_a = props.container) == null ? void 0 : _a.call(props)) || containerRef.value;
42
- });
43
- const containerScrollTopRef = ref(0);
44
- const containerScrollLeftRef = ref(0);
45
- const needYBarRef = computed(() => {
46
- const {
47
- value: containerHeight
48
- } = containerHeightRef;
49
- const {
50
- value: contentHeight
51
- } = contentHeightRef;
52
- return containerHeight !== null && contentHeight !== null && contentHeight > containerHeight;
53
- });
54
- const yBarSizeRef = computed(() => {
55
- const {
56
- value: containerHeight
57
- } = containerHeightRef;
58
- const {
59
- value: contentHeight
60
- } = contentHeightRef;
61
- const {
62
- value: yRailSize
63
- } = yRailSizeRef;
64
- if (containerHeight === null || contentHeight === null || yRailSize === null) {
65
- return 0;
66
- } else {
67
- return Math.min(containerHeight, yRailSize * containerHeight / contentHeight + 5 * 1.5);
68
- }
69
- });
70
- const yBarSizePxRef = computed(() => {
71
- return `${yBarSizeRef.value}px`;
72
- });
73
- const yBarTopRef = computed(() => {
74
- const {
75
- value: containerHeight
76
- } = containerHeightRef;
77
- const {
78
- value: containerScrollTop
79
- } = containerScrollTopRef;
80
- const {
81
- value: contentHeight
82
- } = contentHeightRef;
83
- const {
84
- value: yRailSize
85
- } = yRailSizeRef;
86
- if (containerHeight === null || contentHeight === null || yRailSize === null) {
14
+ const y = () => {
15
+ d();
16
+ }, M = () => {
17
+ d();
18
+ }, w = a(null), h = a(null), T = a(null), v = a(null), s = a(null), R = a(null), f = a(null), m = a(null), P = a(null), b = a(null), k = c(() => {
19
+ var e;
20
+ return ((e = l.content) == null ? void 0 : e.call(l)) || w.value;
21
+ }), x = c(() => {
22
+ var e;
23
+ return ((e = l.container) == null ? void 0 : e.call(l)) || h.value;
24
+ }), X = a(0), Y = a(0), q = c(() => {
25
+ const { value: e } = f, { value: t } = s;
26
+ return e !== null && t !== null && t > e;
27
+ }), C = c(() => {
28
+ const { value: e } = f, { value: t } = s, { value: n } = P;
29
+ return e === null || t === null || n === null ? 0 : Math.min(e, n * e / t + 5 * 1.5);
30
+ }), F = c(() => `${C.value}px`), G = c(() => {
31
+ const { value: e } = f, { value: t } = X, { value: n } = s, { value: r } = P;
32
+ if (e === null || n === null || r === null)
87
33
  return 0;
88
- } else {
89
- const heightDiff = contentHeight - containerHeight;
90
- if (!heightDiff) return 0;
91
- return containerScrollTop / heightDiff * (yRailSize - yBarSizeRef.value);
92
- }
93
- });
94
- const yBarTopPxRef = computed(() => {
95
- return `${yBarTopRef.value}px`;
96
- });
97
- let yBarPressed = false;
98
- let memoYTop = 0;
99
- let memoMouseY = 0;
100
- let yBarVanishTimerId;
101
- let xBarVanishTimerId;
102
- const handleYScrollMouseMove = (e) => {
103
- if (!yBarPressed) return;
104
- if (xBarVanishTimerId !== void 0) {
105
- window.clearTimeout(xBarVanishTimerId);
106
- }
107
- if (yBarVanishTimerId !== void 0) {
108
- window.clearTimeout(yBarVanishTimerId);
109
- }
110
- const {
111
- value: containerHeight
112
- } = containerHeightRef;
113
- const {
114
- value: contentHeight
115
- } = contentHeightRef;
116
- const {
117
- value: yBarSize
118
- } = yBarSizeRef;
119
- if (containerHeight === null || contentHeight === null) return;
120
- const dY = e.clientY - memoMouseY;
121
- const dScrollTop = dY * (contentHeight - containerHeight) / (containerHeight - yBarSize);
122
- const toScrollTopUpperBound = contentHeight - containerHeight;
123
- let toScrollTop = memoYTop + dScrollTop;
124
- toScrollTop = Math.min(toScrollTopUpperBound, toScrollTop);
125
- toScrollTop = Math.max(toScrollTop, 0);
126
- const {
127
- value: container
128
- } = mergedContainerRef;
129
- if (container) {
130
- container.scrollTop = toScrollTop;
34
+ {
35
+ const o = n - e;
36
+ return o ? t / o * (r - C.value) : 0;
131
37
  }
38
+ }), J = c(() => `${G.value}px`);
39
+ let E = !1, D = 0, U = 0, B, p;
40
+ const _ = (e) => {
41
+ if (!E)
42
+ return;
43
+ p !== void 0 && window.clearTimeout(p), B !== void 0 && window.clearTimeout(B);
44
+ const { value: t } = f, { value: n } = s, { value: r } = C;
45
+ if (t === null || n === null)
46
+ return;
47
+ const W = (e.clientY - U) * (n - t) / (t - r), $ = n - t;
48
+ let i = D + W;
49
+ i = Math.min($, i), i = Math.max(i, 0);
50
+ const { value: S } = x;
51
+ S && (S.scrollTop = i);
52
+ }, N = (e) => {
53
+ e.preventDefault(), e.stopPropagation(), g("mousemove", window, _, !0), g("mouseup", window, N, !0), E = !1, d();
54
+ }, Q = (e) => {
55
+ e.preventDefault(), e.stopPropagation(), z("mousemove", window, _, !0), z("mouseup", window, N, !0), D = X.value, U = e.clientY, E = !0;
132
56
  };
133
- const handleYScrollMouseUp = (e) => {
134
- e.preventDefault();
135
- e.stopPropagation();
136
- off("mousemove", window, handleYScrollMouseMove, true);
137
- off("mouseup", window, handleYScrollMouseUp, true);
138
- yBarPressed = false;
139
- sync();
140
- };
141
- const handleYScrollMouseDown = (e) => {
142
- e.preventDefault();
143
- e.stopPropagation();
144
- on("mousemove", window, handleYScrollMouseMove, true);
145
- on("mouseup", window, handleYScrollMouseUp, true);
146
- memoYTop = containerScrollTopRef.value;
147
- memoMouseY = e.clientY;
148
- yBarPressed = true;
149
- };
150
- function handleScroll(e) {
151
- const {
152
- onScroll
153
- } = props;
154
- if (onScroll) onScroll(e);
155
- syncScrollState();
57
+ function Z(e) {
58
+ const { onScroll: t } = l;
59
+ t && t(e), O();
156
60
  }
157
- const needXBarRef = computed(() => {
158
- const {
159
- value: containerWidth
160
- } = containerWidthRef;
161
- const {
162
- value: contentWidth
163
- } = contentWidthRef;
164
- return containerWidth !== null && contentWidth !== null && contentWidth > containerWidth;
165
- });
166
- const xBarSizeRef = computed(() => {
167
- const {
168
- value: containerWidth
169
- } = containerWidthRef;
170
- const {
171
- value: contentWidth
172
- } = contentWidthRef;
173
- const {
174
- value: xRailSize
175
- } = xRailSizeRef;
176
- if (containerWidth === null || contentWidth === null || xRailSize === null) {
61
+ const ee = c(() => {
62
+ const { value: e } = m, { value: t } = R;
63
+ return e !== null && t !== null && t > e;
64
+ }), H = c(() => {
65
+ const { value: e } = m, { value: t } = R, { value: n } = b;
66
+ return e === null || t === null || n === null ? 0 : n * e / t + 5 * 1.5;
67
+ }), te = c(() => `${H.value}px`), ne = c(() => {
68
+ const { value: e } = m, { value: t } = Y, { value: n } = R, { value: r } = b;
69
+ if (e === null || n === null || r === null)
177
70
  return 0;
178
- } else {
179
- return xRailSize * containerWidth / contentWidth + 5 * 1.5;
71
+ {
72
+ const o = n - e;
73
+ return o ? t / o * (r - H.value) : 0;
180
74
  }
181
- });
182
- const xBarSizePxRef = computed(() => {
183
- return `${xBarSizeRef.value}px`;
184
- });
185
- const xBarLeftRef = computed(() => {
186
- const {
187
- value: containerWidth
188
- } = containerWidthRef;
189
- const {
190
- value: containerScrollLeft
191
- } = containerScrollLeftRef;
192
- const {
193
- value: contentWidth
194
- } = contentWidthRef;
195
- const {
196
- value: xRailSize
197
- } = xRailSizeRef;
198
- if (containerWidth === null || contentWidth === null || xRailSize === null) {
199
- return 0;
200
- } else {
201
- const widthDiff = contentWidth - containerWidth;
202
- if (!widthDiff) return 0;
203
- return containerScrollLeft / widthDiff * (xRailSize - xBarSizeRef.value);
204
- }
205
- });
206
- const xBarLeftPxRef = computed(() => {
207
- return `${xBarLeftRef.value}px`;
208
- });
209
- let xBarPressed = false;
210
- let memoXLeft = 0;
211
- let memoMouseX = 0;
212
- const handleXScrollMouseMove = (e) => {
213
- if (!xBarPressed) return;
214
- if (xBarVanishTimerId !== void 0) {
215
- window.clearTimeout(xBarVanishTimerId);
216
- }
217
- if (yBarVanishTimerId !== void 0) {
218
- window.clearTimeout(yBarVanishTimerId);
219
- }
220
- const {
221
- value: containerWidth
222
- } = containerWidthRef;
223
- const {
224
- value: contentWidth
225
- } = contentWidthRef;
226
- const {
227
- value: xBarSize
228
- } = xBarSizeRef;
229
- if (containerWidth === null || contentWidth === null) return;
230
- const dX = e.clientX - memoMouseX;
231
- const dScrollLeft = dX * (contentWidth - containerWidth) / (containerWidth - xBarSize);
232
- const toScrollLeftUpperBound = contentWidth - containerWidth;
233
- let toScrollLeft = memoXLeft + dScrollLeft;
234
- toScrollLeft = Math.min(toScrollLeftUpperBound, toScrollLeft);
235
- toScrollLeft = Math.max(toScrollLeft, 0);
236
- const {
237
- value: container
238
- } = mergedContainerRef;
239
- if (container) {
240
- container.scrollLeft = toScrollLeft;
241
- }
242
- };
243
- const handleXScrollMouseUp = (e) => {
244
- e.preventDefault();
245
- e.stopPropagation();
246
- off("mousemove", window, handleXScrollMouseMove, true);
247
- off("mouseup", window, handleXScrollMouseUp, true);
248
- xBarPressed = false;
249
- sync();
75
+ }), le = c(() => `${ne.value}px`);
76
+ let L = !1, V = 0, I = 0;
77
+ const A = (e) => {
78
+ if (!L)
79
+ return;
80
+ p !== void 0 && window.clearTimeout(p), B !== void 0 && window.clearTimeout(B);
81
+ const { value: t } = m, { value: n } = R, { value: r } = H;
82
+ if (t === null || n === null)
83
+ return;
84
+ const W = (e.clientX - I) * (n - t) / (t - r), $ = n - t;
85
+ let i = V + W;
86
+ i = Math.min($, i), i = Math.max(i, 0);
87
+ const { value: S } = x;
88
+ S && (S.scrollLeft = i);
89
+ }, K = (e) => {
90
+ e.preventDefault(), e.stopPropagation(), g("mousemove", window, A, !0), g("mouseup", window, K, !0), L = !1, d();
250
91
  };
251
- function handleXScrollMouseDown(e) {
252
- e.preventDefault();
253
- e.stopPropagation();
254
- xBarPressed = true;
255
- on("mousemove", window, handleXScrollMouseMove, true);
256
- on("mouseup", window, handleXScrollMouseUp, true);
257
- memoXLeft = containerScrollLeftRef.value;
258
- memoMouseX = e.clientX;
92
+ function oe(e) {
93
+ e.preventDefault(), e.stopPropagation(), L = !0, z("mousemove", window, A, !0), z("mouseup", window, K, !0), V = Y.value, I = e.clientX;
259
94
  }
260
- function syncScrollState() {
261
- const {
262
- value: container
263
- } = mergedContainerRef;
264
- if (container) {
265
- containerScrollTopRef.value = container.scrollTop;
266
- containerScrollLeftRef.value = container.scrollLeft;
267
- }
95
+ function O() {
96
+ const { value: e } = x;
97
+ e && (X.value = e.scrollTop, Y.value = e.scrollLeft);
268
98
  }
269
- const syncPositionState = () => {
270
- const {
271
- value: content
272
- } = mergedContentRef;
273
- if (content) {
274
- const contentClient = content.getBoundingClientRect();
275
- contentHeightRef.value = contentClient.height;
276
- contentWidthRef.value = contentClient.width;
277
- }
278
- const {
279
- value: container
280
- } = mergedContainerRef;
281
- if (container) {
282
- const containerClient = container.getBoundingClientRect();
283
- containerHeightRef.value = containerClient.height;
284
- containerWidthRef.value = containerClient.width;
99
+ const re = () => {
100
+ const { value: e } = k;
101
+ if (e) {
102
+ const o = e.getBoundingClientRect();
103
+ s.value = o.height, R.value = o.width;
285
104
  }
286
- const {
287
- value: yRailEl
288
- } = yRailRef;
289
- if (yRailEl) {
290
- yRailSizeRef.value = yRailEl.offsetHeight;
291
- }
292
- const {
293
- value: xRailEl
294
- } = xRailRef;
295
- if (xRailEl) {
296
- xRailSizeRef.value = xRailEl.offsetWidth;
105
+ const { value: t } = x;
106
+ if (t) {
107
+ const o = t.getBoundingClientRect();
108
+ f.value = o.height, m.value = o.width;
297
109
  }
110
+ const { value: n } = T;
111
+ n && (P.value = n.offsetHeight);
112
+ const { value: r } = v;
113
+ r && (b.value = r.offsetWidth);
298
114
  };
299
- function sync() {
300
- syncPositionState();
301
- syncScrollState();
115
+ function d() {
116
+ re(), O();
302
117
  }
303
118
  return {
304
- sync,
305
- handleContentResize,
306
- handleContainerResize,
307
- contentRef,
308
- yRailRef,
309
- xRailRef,
310
- containerRef,
311
- contentHeightRef,
312
- containerHeightRef,
313
- needYBarRef,
314
- needXBarRef,
315
- yBarSizePxRef,
316
- handleYScrollMouseDown,
317
- handleXScrollMouseDown,
318
- yBarTopPxRef,
319
- handleScroll,
320
- xBarSizePxRef,
321
- xBarLeftPxRef
119
+ sync: d,
120
+ handleContentResize: y,
121
+ handleContainerResize: M,
122
+ contentRef: w,
123
+ yRailRef: T,
124
+ xRailRef: v,
125
+ containerRef: h,
126
+ contentHeightRef: s,
127
+ containerHeightRef: f,
128
+ needYBarRef: q,
129
+ needXBarRef: ee,
130
+ yBarSizePxRef: F,
131
+ handleYScrollMouseDown: Q,
132
+ handleXScrollMouseDown: oe,
133
+ yBarTopPxRef: J,
134
+ handleScroll: Z,
135
+ xBarSizePxRef: te,
136
+ xBarLeftPxRef: le
322
137
  };
323
138
  },
324
139
  render() {
325
- let _slot;
326
- const {
327
- $slots,
328
- xScrollable
329
- } = this;
330
- const createXBar = () => {
331
- return createVNode("div", {
332
- "class": `${defaultNamespace}-scrollbar-rail ${defaultNamespace}-scrollbar-rail--horizontal`,
333
- "ref": "xRailRef"
334
- }, [this.needXBarRef && createVNode("div", {
335
- "class": `${defaultNamespace}-scrollbar-rail__scrollbar--horizontal`,
336
- "style": {
140
+ const { $slots: l, xScrollable: y } = this, M = () => /* @__PURE__ */ React.createElement("div", { class: `${u}-scrollbar-rail ${u}-scrollbar-rail--horizontal`, ref: "xRailRef" }, this.needXBarRef && /* @__PURE__ */ React.createElement(
141
+ "div",
142
+ {
143
+ class: `${u}-scrollbar-rail__scrollbar--horizontal`,
144
+ style: {
337
145
  width: this.xBarSizePxRef,
338
146
  left: this.xBarLeftPxRef
339
147
  },
340
- "onMousedown": this.handleXScrollMouseDown
341
- }, null)]);
342
- };
343
- const createYBar = () => {
344
- return createVNode("div", {
345
- "class": `${defaultNamespace}-scrollbar-rail ${defaultNamespace}-scrollbar-rail--vertical`,
346
- "ref": "yRailRef"
347
- }, [this.needYBarRef && createVNode("div", {
348
- "class": `${defaultNamespace}-scrollbar-rail__scrollbar--vertical`,
349
- "style": {
148
+ onMousedown: this.handleXScrollMouseDown
149
+ }
150
+ )), w = () => /* @__PURE__ */ React.createElement("div", { class: `${u}-scrollbar-rail ${u}-scrollbar-rail--vertical`, ref: "yRailRef" }, this.needYBarRef && /* @__PURE__ */ React.createElement(
151
+ "div",
152
+ {
153
+ class: `${u}-scrollbar-rail__scrollbar--vertical`,
154
+ style: {
350
155
  height: this.yBarSizePxRef,
351
156
  top: this.yBarTopPxRef
352
157
  },
353
- "onMousedown": this.handleYScrollMouseDown
354
- }, null)]);
355
- };
356
- const createChildren = () => {
357
- var _a;
358
- return createVNode("div", mergeProps({
359
- "class": `${defaultNamespace}-scrollbar`
360
- }, this.$attrs), [this.container ? (_a = $slots.default) == null ? void 0 : _a.call($slots) : createVNode("div", {
361
- "class": `${defaultNamespace}-scrollbar-container`,
362
- "onScroll": this.handleScroll,
363
- "ref": "containerRef"
364
- }, [createVNode(VResizeObserver, {
365
- "onResize": this.handleContentResize
366
- }, {
367
- default: () => {
368
- var _a2;
369
- return [createVNode("div", {
370
- "ref": "contentRef",
371
- "class": `${defaultNamespace}-scrollbar-content`
372
- }, [(_a2 = $slots.default) == null ? void 0 : _a2.call($slots)])];
373
- }
374
- })]), createYBar(), xScrollable && createXBar()]);
158
+ onMousedown: this.handleYScrollMouseDown
159
+ }
160
+ )), h = () => {
161
+ var v, s;
162
+ return /* @__PURE__ */ React.createElement("div", { class: `${u}-scrollbar`, ...this.$attrs }, this.container ? (v = l.default) == null ? void 0 : v.call(l) : /* @__PURE__ */ React.createElement("div", { class: `${u}-scrollbar-container`, onScroll: this.handleScroll, ref: "containerRef" }, /* @__PURE__ */ React.createElement(j, { onResize: this.handleContentResize }, /* @__PURE__ */ React.createElement("div", { ref: "contentRef", class: `${u}-scrollbar-content` }, (s = l.default) == null ? void 0 : s.call(l)))), w(), y && M());
375
163
  };
376
- const createBarNode = this.container ? createChildren() : createVNode(VResizeObserver, {
377
- "onResize": this.handleContainerResize
378
- }, _isSlot(_slot = createChildren()) ? _slot : {
379
- default: () => [_slot]
380
- });
381
- return createBarNode;
164
+ return this.container ? h() : /* @__PURE__ */ React.createElement(j, { onResize: this.handleContainerResize }, h());
382
165
  }
383
166
  });
384
-
385
- export { ScrollBar as default };
386
- //# sourceMappingURL=scroll-bar.mjs.map
167
+ export {
168
+ ve as default
169
+ };
@@ -1,9 +1,9 @@
1
- const scrollbarProps = {
1
+ const o = {
2
2
  container: Function,
3
3
  content: Function,
4
4
  onScroll: Function,
5
5
  xScrollable: Boolean
6
6
  };
7
-
8
- export { scrollbarProps };
9
- //# sourceMappingURL=types.mjs.map
7
+ export {
8
+ o as scrollbarProps
9
+ };
@@ -1,19 +1,19 @@
1
- const defaultNamePrefix = "K";
2
- function withInstall(main) {
3
- main.install = (app) => {
4
- const comp = main;
5
- app.component(defaultNamePrefix + comp.name, comp);
6
- };
7
- return main;
1
+ const i = "K";
2
+ function c(t) {
3
+ return t.install = (n) => {
4
+ const e = t;
5
+ n.component(i + e.name, e);
6
+ }, t;
8
7
  }
9
- function withInstallDirectives(main, name) {
8
+ function l(t, n) {
10
9
  return {
11
- install: (app) => {
12
- app.directive(name, main);
10
+ install: (e) => {
11
+ e.directive(n, t);
13
12
  },
14
- directive: main
13
+ directive: t
15
14
  };
16
15
  }
17
-
18
- export { withInstall, withInstallDirectives };
19
- //# sourceMappingURL=install.mjs.map
16
+ export {
17
+ c as withInstall,
18
+ l as withInstallDirectives
19
+ };
@@ -1,9 +1,10 @@
1
- import { withInstall } from '../utils/install.mjs';
2
- import './src/virtual-list.vue.mjs';
3
- export { virtualListProps } from './src/types.mjs';
4
- import _sfc_main from './src/virtual-list.vue2.mjs';
5
-
6
- const KVirtualList = withInstall(_sfc_main);
7
-
8
- export { KVirtualList, KVirtualList as default };
9
- //# sourceMappingURL=index.mjs.map
1
+ import { withInstall as t } from "../utils/install.mjs";
2
+ import "./src/virtual-list.vue.mjs";
3
+ import { virtualListProps as f } from "./src/types.mjs";
4
+ import r from "./src/virtual-list.vue2.mjs";
5
+ const s = t(r);
6
+ export {
7
+ s as KVirtualList,
8
+ s as default,
9
+ f as virtualListProps
10
+ };
@@ -1,11 +1,11 @@
1
- const virtualListProps = {
1
+ const e = {
2
2
  items: {
3
3
  type: Array,
4
4
  default: () => []
5
5
  },
6
6
  itemSize: {
7
7
  type: Number,
8
- required: true
8
+ required: !0
9
9
  },
10
10
  itemResizable: Boolean,
11
11
  paddingTop: {
@@ -25,6 +25,6 @@ const virtualListProps = {
25
25
  onWheel: Function,
26
26
  onResize: Function
27
27
  };
28
-
29
- export { virtualListProps };
30
- //# sourceMappingURL=types.mjs.map
28
+ export {
29
+ e as virtualListProps
30
+ };
@@ -1,6 +1,4 @@
1
- import _sfc_main from './virtual-list.vue2.mjs';
2
-
3
-
4
-
5
- export { _sfc_main as default };
6
- //# sourceMappingURL=virtual-list.vue.mjs.map
1
+ import f from "./virtual-list.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };