@vtable-guild/vtable-guild 2.2.2 → 2.3.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 (154) hide show
  1. package/dist/core/src/components/Button.mjs +108 -0
  2. package/dist/core/src/components/Checkbox.mjs +84 -0
  3. package/dist/core/src/components/Input.mjs +82 -0
  4. package/dist/core/src/components/Radio.mjs +69 -0
  5. package/dist/core/src/components/Scrollbar.mjs +179 -0
  6. package/dist/core/src/components/ScrollbarBar.mjs +103 -0
  7. package/dist/core/src/components/Tooltip.mjs +321 -0
  8. package/dist/core/src/components/VTableGuildConfigProvider.mjs +77 -0
  9. package/dist/core/src/components/VirtualList/Filler.mjs +55 -0
  10. package/dist/core/src/components/VirtualList/Item.mjs +29 -0
  11. package/dist/core/src/components/VirtualList/VirtualList.mjs +373 -0
  12. package/dist/core/src/components/VirtualList/VirtualScrollBar.mjs +216 -0
  13. package/dist/core/src/components/VirtualList/hooks/useChildren.mjs +21 -0
  14. package/dist/core/src/components/VirtualList/hooks/useDiffItem.mjs +16 -0
  15. package/dist/core/src/components/VirtualList/hooks/useFrameWheel.mjs +48 -0
  16. package/dist/core/src/components/VirtualList/hooks/useGetSize.mjs +25 -0
  17. package/dist/core/src/components/VirtualList/hooks/useHeights.mjs +56 -0
  18. package/dist/core/src/components/VirtualList/hooks/useMobileTouchMove.mjs +40 -0
  19. package/dist/core/src/components/VirtualList/hooks/useOriginScroll.mjs +17 -0
  20. package/dist/core/src/components/VirtualList/hooks/useScrollDrag.mjs +41 -0
  21. package/dist/core/src/components/VirtualList/hooks/useScrollTo.mjs +88 -0
  22. package/dist/core/src/components/VirtualList/utils/CacheMap.mjs +24 -0
  23. package/dist/core/src/components/VirtualList/utils/algorithmUtil.mjs +22 -0
  24. package/dist/core/src/components/VirtualList/utils/isFirefox.mjs +4 -0
  25. package/dist/core/src/components/VirtualList/utils/scrollbarUtil.mjs +7 -0
  26. package/dist/core/src/composables/useScrollbar.mjs +55 -0
  27. package/dist/core/src/composables/useTheme.mjs +92 -0
  28. package/dist/core/src/index.d.ts +1 -0
  29. package/dist/core/src/index.d.ts.map +1 -1
  30. package/dist/core/src/plugin/index.mjs +27 -0
  31. package/dist/core/src/utils/classPrefix.mjs +100 -0
  32. package/dist/core/src/utils/devWarn.d.ts +4 -0
  33. package/dist/core/src/utils/devWarn.d.ts.map +1 -0
  34. package/dist/core/src/utils/devWarn.mjs +5 -0
  35. package/dist/core/src/utils/mergeDeep.mjs +20 -0
  36. package/dist/core/src/utils/props.mjs +33 -0
  37. package/dist/core/src/utils/tv.mjs +19 -0
  38. package/dist/icons/src/AntdvEmptyIcon.mjs +37 -0
  39. package/dist/icons/src/AntdvSpinIndicator.mjs +23 -0
  40. package/dist/icons/src/CaretDownIcon.d.ts.map +1 -1
  41. package/dist/icons/src/CaretDownIcon.mjs +9 -0
  42. package/dist/icons/src/CaretRightIcon.d.ts.map +1 -1
  43. package/dist/icons/src/CaretUpIcon.d.ts.map +1 -1
  44. package/dist/icons/src/CaretUpIcon.mjs +9 -0
  45. package/dist/icons/src/DownOutlinedIcon.d.ts.map +1 -1
  46. package/dist/icons/src/DownOutlinedIcon.mjs +9 -0
  47. package/dist/icons/src/ElArrowDownIcon.d.ts.map +1 -1
  48. package/dist/icons/src/ElArrowDownIcon.mjs +9 -0
  49. package/dist/icons/src/ElCaretBottomIcon.d.ts.map +1 -1
  50. package/dist/icons/src/ElCaretBottomIcon.mjs +9 -0
  51. package/dist/icons/src/ElCaretTopIcon.d.ts.map +1 -1
  52. package/dist/icons/src/ElCaretTopIcon.mjs +9 -0
  53. package/dist/icons/src/ElFilterIcon.d.ts.map +1 -1
  54. package/dist/icons/src/ElLoadingIcon.mjs +28 -0
  55. package/dist/icons/src/FilterFilledIcon.d.ts.map +1 -1
  56. package/dist/icons/src/FilterFilledIcon.mjs +9 -0
  57. package/dist/icons/src/SearchIcon.d.ts.map +1 -1
  58. package/dist/icons/src/SearchIcon.mjs +9 -0
  59. package/dist/icons/src/createSvgIcon.d.ts +13 -0
  60. package/dist/icons/src/createSvgIcon.d.ts.map +1 -0
  61. package/dist/icons/src/createSvgIcon.mjs +23 -0
  62. package/dist/index.mjs +82 -10196
  63. package/dist/table/src/components/ColGroup.mjs +25 -0
  64. package/dist/table/src/components/ExpandIcon.mjs +60 -0
  65. package/dist/table/src/components/FilterDropdown.d.ts.map +1 -1
  66. package/dist/table/src/components/FilterDropdown.mjs +324 -0
  67. package/dist/table/src/components/FilterIcon.mjs +30 -0
  68. package/dist/table/src/components/ResizeHandle.mjs +28 -0
  69. package/dist/table/src/components/SelectionCheckbox.mjs +33 -0
  70. package/dist/table/src/components/SelectionDropdown.d.ts.map +1 -1
  71. package/dist/table/src/components/SelectionDropdown.mjs +73 -0
  72. package/dist/table/src/components/SelectionRadio.mjs +28 -0
  73. package/dist/table/src/components/SortButton.mjs +30 -0
  74. package/dist/table/src/components/Table.d.ts.map +1 -1
  75. package/dist/table/src/components/Table.mjs +781 -0
  76. package/dist/table/src/components/TableBody.mjs +124 -0
  77. package/dist/table/src/components/TableCell.d.ts.map +1 -1
  78. package/dist/table/src/components/TableCell.mjs +222 -0
  79. package/dist/table/src/components/TableEmpty.mjs +38 -0
  80. package/dist/table/src/components/TableHeader.mjs +51 -0
  81. package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
  82. package/dist/table/src/components/TableHeaderCell.mjs +391 -0
  83. package/dist/table/src/components/TableLoading.mjs +46 -0
  84. package/dist/table/src/components/TableRow.mjs +34 -0
  85. package/dist/table/src/components/VTable.vue.d.ts.map +1 -1
  86. package/dist/table/src/components/VTable.vue.mjs +155 -0
  87. package/dist/table/src/components/VTable.vue2.mjs +4 -0
  88. package/dist/table/src/components/VTableSummary.mjs +29 -0
  89. package/dist/table/src/components/VTableSummaryCell.d.ts.map +1 -1
  90. package/dist/table/src/components/VTableSummaryCell.mjs +68 -0
  91. package/dist/table/src/components/VTableSummaryRow.mjs +19 -0
  92. package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
  93. package/dist/table/src/components/VirtualTableBody.mjs +172 -0
  94. package/dist/table/src/composables/index.d.ts +2 -1
  95. package/dist/table/src/composables/index.d.ts.map +1 -1
  96. package/dist/table/src/composables/useColumns.d.ts +6 -1
  97. package/dist/table/src/composables/useColumns.d.ts.map +1 -1
  98. package/dist/table/src/composables/useColumns.mjs +81 -0
  99. package/dist/table/src/composables/useControlledColumnState.d.ts +24 -0
  100. package/dist/table/src/composables/useControlledColumnState.d.ts.map +1 -0
  101. package/dist/table/src/composables/useControlledColumnState.mjs +23 -0
  102. package/dist/table/src/composables/useExpand.mjs +37 -0
  103. package/dist/table/src/composables/useFilter.d.ts.map +1 -1
  104. package/dist/table/src/composables/useFilter.mjs +68 -0
  105. package/dist/table/src/composables/useFixedColumnStyle.d.ts +18 -0
  106. package/dist/table/src/composables/useFixedColumnStyle.d.ts.map +1 -0
  107. package/dist/table/src/composables/useFixedColumnStyle.mjs +21 -0
  108. package/dist/table/src/composables/useHoverState.mjs +26 -0
  109. package/dist/table/src/composables/useResize.mjs +42 -0
  110. package/dist/table/src/composables/useScroll.d.ts +5 -4
  111. package/dist/table/src/composables/useScroll.d.ts.map +1 -1
  112. package/dist/table/src/composables/useScroll.mjs +68 -0
  113. package/dist/table/src/composables/useSelection.d.ts.map +1 -1
  114. package/dist/table/src/composables/useSelection.mjs +246 -0
  115. package/dist/table/src/composables/useSorter.d.ts +1 -5
  116. package/dist/table/src/composables/useSorter.d.ts.map +1 -1
  117. package/dist/table/src/composables/useSorter.mjs +161 -0
  118. package/dist/table/src/composables/useTreeData.d.ts +2 -0
  119. package/dist/table/src/composables/useTreeData.d.ts.map +1 -1
  120. package/dist/table/src/composables/useTreeData.mjs +92 -0
  121. package/dist/table/src/composables/useVirtual.mjs +19 -0
  122. package/dist/table/src/constants.mjs +8 -0
  123. package/dist/table/src/context.d.ts +90 -85
  124. package/dist/table/src/context.d.ts.map +1 -1
  125. package/dist/table/src/context.mjs +4 -0
  126. package/dist/table/src/index.d.ts.map +1 -1
  127. package/dist/table/src/index.mjs +23 -0
  128. package/dist/table/src/preset-config.mjs +35 -0
  129. package/dist/table/src/utils/cell.mjs +79 -0
  130. package/dist/table/src/utils/popupPosition.d.ts +20 -0
  131. package/dist/table/src/utils/popupPosition.d.ts.map +1 -0
  132. package/dist/table/src/utils/popupPosition.mjs +24 -0
  133. package/dist/table/src/utils/popupPosition.test.d.ts +2 -0
  134. package/dist/table/src/utils/popupPosition.test.d.ts.map +1 -0
  135. package/dist/table/src/utils/vnode.mjs +10 -0
  136. package/dist/theme/src/presets/antdv/button.mjs +70 -0
  137. package/dist/theme/src/presets/antdv/checkbox.mjs +51 -0
  138. package/dist/theme/src/presets/antdv/input.mjs +40 -0
  139. package/dist/theme/src/presets/antdv/radio.mjs +34 -0
  140. package/dist/theme/src/presets/antdv/scrollbar.mjs +22 -0
  141. package/dist/theme/src/presets/antdv/table-locale.mjs +55 -0
  142. package/dist/theme/src/presets/antdv/table.mjs +285 -0
  143. package/dist/theme/src/presets/antdv/tooltip.mjs +20 -0
  144. package/dist/theme/src/presets/element-plus/button.mjs +70 -0
  145. package/dist/theme/src/presets/element-plus/checkbox.mjs +65 -0
  146. package/dist/theme/src/presets/element-plus/input.mjs +39 -0
  147. package/dist/theme/src/presets/element-plus/radio.mjs +34 -0
  148. package/dist/theme/src/presets/element-plus/scrollbar.mjs +22 -0
  149. package/dist/theme/src/presets/element-plus/table-locale.mjs +56 -0
  150. package/dist/theme/src/presets/element-plus/table.mjs +235 -0
  151. package/dist/theme/src/presets/element-plus/tooltip.mjs +21 -0
  152. package/dist/theme/src/presets/index.mjs +92 -0
  153. package/package.json +5 -2
  154. package/dist/index.cjs +0 -1
@@ -0,0 +1,56 @@
1
+ import I from "../utils/CacheMap.mjs";
2
+ import { ref as d, markRaw as O, onUnmounted as y } from "vue";
3
+ function h(n) {
4
+ const c = parseFloat(n);
5
+ return isNaN(c) ? 0 : c;
6
+ }
7
+ function R(n) {
8
+ return n instanceof HTMLElement ? n : n?.$el instanceof HTMLElement ? n.$el : null;
9
+ }
10
+ function B(n, c, z) {
11
+ const v = d(0), i = d(/* @__PURE__ */ new Map()), f = O(new I()), l = d(0), a = /* @__PURE__ */ new Map(), s = typeof window < "u" && "ResizeObserver" in window ? new window.ResizeObserver(() => {
12
+ u();
13
+ }) : null;
14
+ function g() {
15
+ l.value += 1;
16
+ }
17
+ function u(m = !1) {
18
+ g();
19
+ const o = () => {
20
+ let e = !1;
21
+ i.value.forEach((p, r) => {
22
+ const t = R(p);
23
+ if (t && t.offsetParent) {
24
+ const { offsetHeight: H } = t, { marginTop: M, marginBottom: E } = getComputedStyle(t), N = h(M), T = h(E), w = H + N + T;
25
+ f.get(r) !== w && (f.set(r, w), e = !0);
26
+ }
27
+ }), e && (v.value += 1);
28
+ };
29
+ if (m)
30
+ o();
31
+ else {
32
+ l.value += 1;
33
+ const e = l.value;
34
+ Promise.resolve().then(() => {
35
+ e === l.value && o();
36
+ });
37
+ }
38
+ }
39
+ function b(m, o) {
40
+ const e = n(m);
41
+ if (i.value.get(e) === o) return;
42
+ const r = a.get(e);
43
+ if (r && s && (s.unobserve(r), a.delete(e)), o) {
44
+ i.value.set(e, o), u();
45
+ const t = R(o);
46
+ t && t.nodeType === 1 && s && (s.observe(t), a.set(e, t));
47
+ } else
48
+ i.value.delete(e);
49
+ }
50
+ return y(() => {
51
+ g(), s?.disconnect?.(), a.clear();
52
+ }), [b, u, f, v];
53
+ }
54
+ export {
55
+ B as default
56
+ };
@@ -0,0 +1,40 @@
1
+ import { ref as f, onUnmounted as R, watch as S } from "vue";
2
+ const g = 14 / 15;
3
+ function H(I, X, h) {
4
+ const l = f(!1), r = f(0), i = f(0);
5
+ let o = null, t = null, s = null;
6
+ const d = (e) => {
7
+ if (l.value) {
8
+ const n = Math.ceil(e.touches[0].pageX), E = Math.ceil(e.touches[0].pageY);
9
+ let u = r.value - n, c = i.value - E;
10
+ const a = Math.abs(u) > Math.abs(c);
11
+ a ? r.value = n : i.value = E;
12
+ const L = h(a, a ? u : c, !1, e);
13
+ L && e.preventDefault(), t && clearInterval(t), L && (t = setInterval(() => {
14
+ a ? u *= g : c *= g;
15
+ const T = Math.floor(a ? u : c);
16
+ (!h(a, T, !0) || Math.abs(T) <= 0.1) && t && clearInterval(t);
17
+ }, 16));
18
+ }
19
+ }, v = () => {
20
+ o && (o.removeEventListener("touchmove", d), o.removeEventListener("touchend", m), o = null);
21
+ }, m = () => {
22
+ l.value = !1, v();
23
+ }, M = (e) => {
24
+ v(), e.touches.length === 1 && !l.value && (l.value = !0, r.value = Math.ceil(e.touches[0].pageX), i.value = Math.ceil(e.touches[0].pageY), o = e.target, o.addEventListener("touchmove", d, { passive: !1 }), o.addEventListener("touchend", m, { passive: !0 }));
25
+ }, Y = () => {
26
+ s && (s.removeEventListener("touchstart", M), s = null);
27
+ }, p = () => {
28
+ Y(), v(), t && (clearInterval(t), t = null);
29
+ };
30
+ R(p), S(
31
+ [I, X],
32
+ ([e, n]) => {
33
+ e && n ? (s = n, n.addEventListener("touchstart", M, { passive: !0 })) : p();
34
+ },
35
+ { immediate: !0 }
36
+ );
37
+ }
38
+ export {
39
+ H as default
40
+ };
@@ -0,0 +1,17 @@
1
+ import { ref as s } from "vue";
2
+ function m(r, i, a, f) {
3
+ const e = s(!1);
4
+ let l = null;
5
+ function t() {
6
+ l && clearTimeout(l), e.value = !0, l = setTimeout(() => {
7
+ e.value = !1;
8
+ }, 50);
9
+ }
10
+ return (c, u, n = !1) => {
11
+ const o = c ? u < 0 && a.value || u > 0 && f.value : u < 0 && r.value || u > 0 && i.value;
12
+ return n && o ? (l && clearTimeout(l), e.value = !1) : (!o || e.value) && t(), !e.value && o;
13
+ };
14
+ }
15
+ export {
16
+ m as default
17
+ };
@@ -0,0 +1,41 @@
1
+ import { onUnmounted as h, watch as p } from "vue";
2
+ function E(n) {
3
+ return Math.floor(n ** 0.5);
4
+ }
5
+ function D(n, d) {
6
+ return ("touches" in n ? n.touches[0] : n).pageY - window.scrollY;
7
+ }
8
+ function M(n, d, L) {
9
+ let o = null, t = null, u = !1, s = null, a = 0;
10
+ const i = () => {
11
+ s !== null && (cancelAnimationFrame(s), s = null);
12
+ }, c = () => {
13
+ i(), s = requestAnimationFrame(() => {
14
+ L(a), c();
15
+ });
16
+ }, l = () => {
17
+ u = !1, i();
18
+ }, m = (r) => {
19
+ if (r.target.draggable || r.button !== 0) return;
20
+ const e = r;
21
+ e._virtualHandled || (e._virtualHandled = !0, u = !0);
22
+ }, f = (r) => {
23
+ if (u && o) {
24
+ const e = D(r), { top: g, bottom: w } = o.getBoundingClientRect();
25
+ e <= g ? (a = -E(g - e), c()) : e >= w ? (a = E(e - w), c()) : i();
26
+ }
27
+ }, v = () => {
28
+ o && (o.removeEventListener("mousedown", m), o = null), t && (t.removeEventListener("mouseup", l), t.removeEventListener("mousemove", f), t.removeEventListener("dragend", l), t = null), l();
29
+ };
30
+ h(v), p(
31
+ [n, d],
32
+ ([r, e]) => {
33
+ r && e ? (o = e, t = e.ownerDocument, o.addEventListener("mousedown", m), t.addEventListener("mouseup", l), t.addEventListener("mousemove", f), t.addEventListener("dragend", l)) : v();
34
+ },
35
+ { immediate: !0 }
36
+ );
37
+ }
38
+ export {
39
+ M as default,
40
+ D as getPageXY
41
+ };
@@ -0,0 +1,88 @@
1
+ import { shallowRef as B, watch as I } from "vue";
2
+ const S = 10;
3
+ function E(h, n, g, d, v, w, k, y) {
4
+ const t = B(null), M = () => {
5
+ let e = 0;
6
+ for (let o = 0; o < n.value.length; o += 1) {
7
+ const c = v(n.value[o]), i = g.get(c);
8
+ e += i === void 0 ? d.value ?? 0 : i;
9
+ }
10
+ return e;
11
+ };
12
+ return I(
13
+ t,
14
+ () => {
15
+ if (t.value && t.value.times < S) {
16
+ if (!h.value) {
17
+ t.value = { ...t.value };
18
+ return;
19
+ }
20
+ w();
21
+ const { targetAlign: e, originAlign: o, index: c, offset: i } = t.value, s = h.value.clientHeight;
22
+ let p = !1, T = e ?? null, u = null;
23
+ if (s) {
24
+ const b = e || o;
25
+ let x = 0, r = 0, m = 0;
26
+ const A = Math.min(n.value.length - 1, c);
27
+ for (let l = 0; l <= A; l += 1) {
28
+ const f = v(n.value[l]);
29
+ r = x;
30
+ const a = g.get(f);
31
+ m = r + (a === void 0 ? d.value ?? 0 : a), x = m;
32
+ }
33
+ let H = b === "top" ? i : s - i;
34
+ for (let l = A; l >= 0; l -= 1) {
35
+ const f = v(n.value[l]), a = g.get(f);
36
+ if (a === void 0) {
37
+ p = !0;
38
+ break;
39
+ }
40
+ if (H -= a, H <= 0) break;
41
+ }
42
+ switch (b) {
43
+ case "top":
44
+ u = r - i;
45
+ break;
46
+ case "bottom":
47
+ u = m - s + i;
48
+ break;
49
+ default: {
50
+ const { scrollTop: l } = h.value, f = l + s;
51
+ r < l ? T = "top" : m > f && (T = "bottom");
52
+ }
53
+ }
54
+ u !== null && k(u), u !== t.value.lastTop && (p = !0);
55
+ }
56
+ p && (t.value = {
57
+ ...t.value,
58
+ times: t.value.times + 1,
59
+ targetAlign: T,
60
+ lastTop: u
61
+ });
62
+ }
63
+ },
64
+ { immediate: !0, flush: "post" }
65
+ ), [(e) => {
66
+ if (e == null) {
67
+ y();
68
+ return;
69
+ }
70
+ if (typeof e == "number")
71
+ k(e);
72
+ else if (e && typeof e == "object") {
73
+ let o;
74
+ const { align: c } = e;
75
+ "index" in e ? o = e.index : o = n.value.findIndex((s) => v(s) === e.key);
76
+ const { offset: i = 0 } = e;
77
+ t.value = {
78
+ times: 0,
79
+ index: o,
80
+ offset: i,
81
+ originAlign: c
82
+ };
83
+ }
84
+ }, M];
85
+ }
86
+ export {
87
+ E as default
88
+ };
@@ -0,0 +1,24 @@
1
+ import { shallowRef as t } from "vue";
2
+ class i {
3
+ maps;
4
+ id = t(0);
5
+ diffRecords = /* @__PURE__ */ new Map();
6
+ constructor() {
7
+ this.maps = /* @__PURE__ */ Object.create(null);
8
+ }
9
+ set(s, e) {
10
+ this.diffRecords.set(s, this.maps[s]), this.maps[s] = e, this.id.value += 1;
11
+ }
12
+ get(s) {
13
+ return this.maps[s];
14
+ }
15
+ resetRecord() {
16
+ this.diffRecords.clear();
17
+ }
18
+ getRecord() {
19
+ return this.diffRecords;
20
+ }
21
+ }
22
+ export {
23
+ i as default
24
+ };
@@ -0,0 +1,22 @@
1
+ function x(t, l, d) {
2
+ const f = t.length, o = l.length;
3
+ let r, n;
4
+ if (f === 0 && o === 0) return null;
5
+ f < o ? (r = t, n = l) : (r = l, n = t);
6
+ const h = { __EMPTY_ITEM__: !0 };
7
+ function u(e) {
8
+ return e !== void 0 ? d(e) : h;
9
+ }
10
+ let i = null, s = Math.abs(f - o) !== 1;
11
+ for (let e = 0; e < n.length; e += 1) {
12
+ const c = u(r[e]);
13
+ if (c !== u(n[e])) {
14
+ i = e, s = s || c !== u(n[e + 1]);
15
+ break;
16
+ }
17
+ }
18
+ return i === null ? null : { index: i, multiple: s };
19
+ }
20
+ export {
21
+ x as findListDiffIndex
22
+ };
@@ -0,0 +1,4 @@
1
+ const t = typeof navigator == "object" && /Firefox/i.test(navigator.userAgent);
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,7 @@
1
+ function i(e = 0, a = 0) {
2
+ let t = e / a * e;
3
+ return isNaN(t) && (t = 0), t = Math.max(t, 20), Math.floor(t);
4
+ }
5
+ export {
6
+ i as getSpinSize
7
+ };
@@ -0,0 +1,55 @@
1
+ import { ref as t, onMounted as g, onBeforeUnmount as k, computed as O } from "vue";
2
+ function V(S, p, d) {
3
+ const r = t(0), u = t(0), a = t(!1), c = t(0), v = t(0), f = t(!1);
4
+ let l = null;
5
+ function m() {
6
+ const o = S.value;
7
+ if (!o) return;
8
+ const { clientHeight: e, scrollHeight: b, clientWidth: h, scrollWidth: z, scrollTop: w, scrollLeft: M } = o;
9
+ if (b > e) {
10
+ a.value = !0;
11
+ const i = e, s = Math.max(d.minSize, i * (e / b));
12
+ r.value = s;
13
+ const n = b - e;
14
+ u.value = n > 0 ? w / n * (i - s) : 0;
15
+ } else
16
+ a.value = !1, r.value = 0, u.value = 0;
17
+ if (z > h) {
18
+ f.value = !0;
19
+ const i = h, s = Math.max(d.minSize, i * (h / z));
20
+ c.value = s;
21
+ const n = z - h;
22
+ v.value = n > 0 ? M / n * (i - s) : 0;
23
+ } else
24
+ f.value = !1, c.value = 0, v.value = 0;
25
+ }
26
+ g(() => {
27
+ const o = S.value, e = p.value;
28
+ o && (l = new ResizeObserver(() => m()), l.observe(o), e && l.observe(e), m());
29
+ }), k(() => {
30
+ l?.disconnect(), l = null;
31
+ });
32
+ const x = O(() => ({
33
+ thumbSize: r,
34
+ thumbOffset: u,
35
+ visible: a
36
+ })), T = O(() => ({
37
+ thumbSize: c,
38
+ thumbOffset: v,
39
+ visible: f
40
+ }));
41
+ return {
42
+ vertical: x,
43
+ horizontal: T,
44
+ update: m,
45
+ verticalThumbSize: r,
46
+ verticalThumbOffset: u,
47
+ verticalVisible: a,
48
+ horizontalThumbSize: c,
49
+ horizontalThumbOffset: v,
50
+ horizontalVisible: f
51
+ };
52
+ }
53
+ export {
54
+ V as useScrollbar
55
+ };
@@ -0,0 +1,92 @@
1
+ import { inject as y, computed as p, unref as V } from "vue";
2
+ import { tv as d } from "../utils/tv.mjs";
3
+ import { VTABLE_GUILD_INJECTION_KEY as j } from "../plugin/index.mjs";
4
+ import { prefixThemeConfig as C, cnByCssMode as O } from "../utils/classPrefix.mjs";
5
+ import { cn as v } from "tailwind-variants";
6
+ function E(t, o, s) {
7
+ const e = y(j, null), a = p(() => e?.cssMode ?? "prebuilt"), g = p(() => e?.classPrefix ?? "vtg"), i = p(() => {
8
+ const n = C(
9
+ V(o),
10
+ a.value,
11
+ g.value
12
+ ), c = e?.theme?.[t], r = x(n, c), u = d(r), f = {};
13
+ if (r.variants)
14
+ for (const m of Object.keys(r.variants))
15
+ m in s && s[m] !== void 0 && (f[m] = s[m]);
16
+ return u(f);
17
+ }), l = {};
18
+ for (const n of Object.keys(V(o).slots))
19
+ l[n] = () => {
20
+ const c = i.value, r = typeof c[n] == "function" ? c[n]() : c[n] ?? "", f = (s.ui ?? {})[n] ?? "", m = n === "root" ? s.class ?? "" : "";
21
+ return O(a.value, g.value, r, f, m) ?? "";
22
+ };
23
+ return {
24
+ slots: l
25
+ };
26
+ }
27
+ function x(t, o) {
28
+ return o ? {
29
+ // ---- slots: cn() 智能合并 ----
30
+ // 示例:base.th = 'px-4 text-left', override.th = 'px-6'
31
+ // → cn('px-4 text-left', 'px-6') → 'text-left px-6'
32
+ slots: S(t.slots ?? {}, o.slots),
33
+ // ---- variants: 深合并 ----
34
+ // 示例:base.variants.size.sm = { th: 'px-2' },
35
+ // override.variants.size.sm = { th: 'px-3' }
36
+ // → { th: cn('px-2', 'px-3') } → { th: 'px-3' }
37
+ variants: T(t.variants, o.variants),
38
+ // ---- defaultVariants: 浅合并 ----
39
+ // 示例:base = { size: 'md', bordered: false },
40
+ // override = { size: 'sm' }
41
+ // → { size: 'sm', bordered: false }
42
+ defaultVariants: {
43
+ ...t.defaultVariants,
44
+ ...o.defaultVariants
45
+ },
46
+ // ---- compoundVariants: 追加 ----
47
+ // 用户的规则追加到末尾,tailwind-variants 按顺序处理,后者优先级更高
48
+ compoundVariants: [...t.compoundVariants ?? [], ...o.compoundVariants ?? []],
49
+ // ---- compoundSlots: 追加 ----
50
+ compoundSlots: [...t.compoundSlots ?? [], ...o.compoundSlots ?? []]
51
+ } : t;
52
+ }
53
+ function S(t, o) {
54
+ if (!o) return t;
55
+ const s = { ...t };
56
+ for (const [e, a] of Object.entries(o))
57
+ s[e] = e in t ? v(t[e], a) ?? "" : a;
58
+ return s;
59
+ }
60
+ function T(t, o) {
61
+ if (!t && !o) return;
62
+ if (!t) return o;
63
+ if (!o) return t;
64
+ const s = { ...t };
65
+ for (const [e, a] of Object.entries(o))
66
+ if (!(e in s))
67
+ s[e] = a;
68
+ else {
69
+ const i = { ...s[e] };
70
+ for (const [l, n] of Object.entries(a))
71
+ if (!(l in i))
72
+ i[l] = n;
73
+ else {
74
+ const c = i[l];
75
+ if (typeof c == "string" && typeof n == "string")
76
+ i[l] = v(c, n) ?? "";
77
+ else if (typeof c == "object" && typeof n == "object") {
78
+ const r = { ...c };
79
+ for (const [u, f] of Object.entries(n))
80
+ r[u] = u in r ? v(r[u], f) ?? "" : f;
81
+ i[l] = r;
82
+ } else
83
+ i[l] = n;
84
+ }
85
+ s[e] = i;
86
+ }
87
+ return s;
88
+ }
89
+ export {
90
+ x as mergeThemeConfigs,
91
+ E as useTheme
92
+ };
@@ -2,6 +2,7 @@ import { DeepPartial, LocaleName, LocaleRegistry, ThemePresetName, VTableGuildCs
2
2
  export { tv, cn } from './utils/tv';
3
3
  export { DEFAULT_VTG_CLASS_PREFIX, normalizeVtgClassPrefix, prefixVtgClassNames, cnByCssMode, } from './utils/classPrefix';
4
4
  export { optionalProp, requiredProp, optionalBoolProp, optionalStringProp } from './utils/props';
5
+ export { devWarn } from './utils/devWarn';
5
6
  export type { DeepPartial, LocaleName, LocaleRegistry, ThemeConfig, ThemeOverrideConfig, SlotProps, ThemePresetName, VTableGuildCssMode, VTableGuildLocale, VTableGuildTableLocale, VTableGuildTableHeaderLocale, VTableGuildTableFilterDropdownLocale, VTableGuildTableEmptyLocale, VTableGuildTableLoadingLocale, VTableGuildTableSelectionLocale, } from './utils/types';
6
7
  export interface VTableGuildThemeOverridesMap {
7
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,GACZ,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAChG,OAAO,KAAK,EACV,WAAW,EACX,UAA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qB,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,YAAY,EACV,SAAS,EACT,OAAO,EACP,YAAY,IAAI,mBAAmB,EACnC,UAAU,IAAI,iBAAiB,EAC/B,eAAe,EACf,sBAAsB,GACvB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,27 @@
1
+ import { reactive as l } from "vue";
2
+ import { normalizeVtgClassPrefix as c } from "../utils/classPrefix.mjs";
3
+ const a = /* @__PURE__ */ Symbol("vtable-guild");
4
+ function s(e) {
5
+ typeof document > "u" || document.documentElement.setAttribute("data-vtg-preset", e);
6
+ }
7
+ function n(e = {}) {
8
+ return {
9
+ install(r) {
10
+ const t = l({
11
+ themePreset: e.themePreset ?? "antdv",
12
+ cssMode: e.cssMode ?? "prebuilt",
13
+ classPrefix: c(e.classPrefix),
14
+ theme: e.theme ?? {},
15
+ locale: e.locale ?? "zh-CN",
16
+ locales: e.locales ?? {},
17
+ localeOverrides: e.localeOverrides ?? {}
18
+ });
19
+ r.provide(a, t), s(t.themePreset);
20
+ }
21
+ };
22
+ }
23
+ export {
24
+ a as VTABLE_GUILD_INJECTION_KEY,
25
+ n as createVTableGuild,
26
+ s as syncDocumentPresetAttr
27
+ };
@@ -0,0 +1,100 @@
1
+ import { cn as m } from "tailwind-variants";
2
+ const p = "vtg", h = "prebuilt";
3
+ function $(t) {
4
+ return (t ?? p).trim().replace(/-+$/, "") || p;
5
+ }
6
+ function g(t) {
7
+ const n = [];
8
+ let i = 0, r = 0, e = 0;
9
+ for (let o = 0; o < t.length; o++) {
10
+ const f = t[o];
11
+ f === "[" ? i++ : f === "]" ? i-- : f === "(" ? r++ : f === ")" ? r-- : f === ":" && i === 0 && r === 0 && (n.push(t.slice(e, o)), e = o + 1);
12
+ }
13
+ return n.push(t.slice(e)), n;
14
+ }
15
+ function d(t, n) {
16
+ return !t || t.startsWith("[") || t.startsWith(`${n}-`) || t.startsWith(`-${n}-`) ? t : t.startsWith("!") ? `!${d(t.slice(1), n)}` : t.startsWith("-") ? `-${n}-${t.slice(1)}` : `${n}-${t}`;
17
+ }
18
+ function B(t, n) {
19
+ return t.startsWith(`!${n}-`) ? `!${t.slice(n.length + 2)}` : t.startsWith(`-${n}-`) ? `-${t.slice(n.length + 2)}` : t.startsWith(`${n}-`) ? t.slice(n.length + 1) : t;
20
+ }
21
+ function O(t, n) {
22
+ const i = g(t), r = i[i.length - 1] ?? "";
23
+ return r.startsWith(`${n}-`) || r.startsWith(`-${n}-`) || r.startsWith(`!${n}-`);
24
+ }
25
+ function W(t, n) {
26
+ const i = g(t), r = i.pop() ?? "";
27
+ return i.push(n(r)), i.join(":");
28
+ }
29
+ function a(t, n, i = p) {
30
+ if (n !== h || !t) return t;
31
+ const r = $(i);
32
+ return t.split(/\s+/).filter(Boolean).map((e) => W(e, (o) => d(o, r))).join(" ");
33
+ }
34
+ function E(t, n) {
35
+ return t.split(/\s+/).filter(Boolean).map((i) => W(i, (r) => B(r, n))).join(" ");
36
+ }
37
+ function y(t, n, ...i) {
38
+ if (t !== h) return m(...i) ?? "";
39
+ const r = $(n), e = [], o = [];
40
+ for (const u of i)
41
+ if (u)
42
+ for (const l of u.split(/\s+/).filter(Boolean))
43
+ O(l, r) ? e.push(l) : o.push(l);
44
+ const f = a(
45
+ m(E(e.join(" "), r)) ?? "",
46
+ t,
47
+ r
48
+ ), s = m(o.join(" ")) ?? "";
49
+ return [f, s].filter(Boolean).join(" ");
50
+ }
51
+ function c(t, n, i) {
52
+ if (typeof t == "string") return a(t, n, i);
53
+ if (Array.isArray(t)) return t.map((e) => c(e, n, i));
54
+ if (!t || typeof t != "object") return t;
55
+ const r = {};
56
+ for (const [e, o] of Object.entries(t))
57
+ r[e] = c(o, n, i);
58
+ return r;
59
+ }
60
+ function j(t, n, i) {
61
+ const r = { ...t };
62
+ return "class" in r && (r.class = c(r.class, n, i)), r;
63
+ }
64
+ function z(t, n, i = p) {
65
+ if (n !== h) return t;
66
+ const r = $(i), e = t.variants ? Object.fromEntries(
67
+ Object.entries(t.variants).map(([o, f]) => [
68
+ o,
69
+ Object.fromEntries(
70
+ Object.entries(f).map(([s, u]) => [
71
+ s,
72
+ c(u, n, r)
73
+ ])
74
+ )
75
+ ])
76
+ ) : void 0;
77
+ return {
78
+ ...t,
79
+ slots: Object.fromEntries(
80
+ Object.entries(t.slots ?? {}).map(([o, f]) => [
81
+ o,
82
+ a(f, n, r)
83
+ ])
84
+ ),
85
+ variants: e,
86
+ compoundVariants: t.compoundVariants?.map(
87
+ (o) => j(o, n, r)
88
+ ),
89
+ compoundSlots: t.compoundSlots?.map(
90
+ (o) => j(o, n, r)
91
+ )
92
+ };
93
+ }
94
+ export {
95
+ p as DEFAULT_VTG_CLASS_PREFIX,
96
+ y as cnByCssMode,
97
+ $ as normalizeVtgClassPrefix,
98
+ z as prefixThemeConfig,
99
+ a as prefixVtgClassNames
100
+ };
@@ -0,0 +1,4 @@
1
+ export declare function devWarn(id: string, message: string): void;
2
+ /** 仅供测试使用:清空去重记录 */
3
+ export declare function resetDevWarnedForTest(): void;
4
+ //# sourceMappingURL=devWarn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devWarn.d.ts","sourceRoot":"","sources":["../../../../../core/src/utils/devWarn.ts"],"names":[],"mappings":"AAeA,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAKzD;AAED,oBAAoB;AACpB,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
@@ -0,0 +1,5 @@
1
+ function r(e, n) {
2
+ }
3
+ export {
4
+ r as devWarn
5
+ };
@@ -0,0 +1,20 @@
1
+ function i(n) {
2
+ return typeof n == "object" && n !== null && !Array.isArray(n);
3
+ }
4
+ function u(n, o) {
5
+ if (!o) return { ...n };
6
+ const t = { ...n };
7
+ for (const [r, e] of Object.entries(o)) {
8
+ if (e === void 0) continue;
9
+ const c = t[r];
10
+ if (i(c) && i(e)) {
11
+ t[r] = u(c, e);
12
+ continue;
13
+ }
14
+ t[r] = e;
15
+ }
16
+ return t;
17
+ }
18
+ export {
19
+ u as mergeDeep
20
+ };
@@ -0,0 +1,33 @@
1
+ function r(e) {
2
+ return {
3
+ type: [String, Number, Boolean, Object, Array, Function],
4
+ required: !1,
5
+ default: e
6
+ };
7
+ }
8
+ function t() {
9
+ return {
10
+ type: [String, Number, Boolean, Object, Array, Function],
11
+ required: !0
12
+ };
13
+ }
14
+ function n(e = !1) {
15
+ return {
16
+ type: Boolean,
17
+ required: !1,
18
+ default: e
19
+ };
20
+ }
21
+ function o(e) {
22
+ return {
23
+ type: String,
24
+ required: !1,
25
+ default: e
26
+ };
27
+ }
28
+ export {
29
+ n as optionalBoolProp,
30
+ r as optionalProp,
31
+ o as optionalStringProp,
32
+ t as requiredProp
33
+ };