@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.
- package/dist/core/src/components/Button.mjs +108 -0
- package/dist/core/src/components/Checkbox.mjs +84 -0
- package/dist/core/src/components/Input.mjs +82 -0
- package/dist/core/src/components/Radio.mjs +69 -0
- package/dist/core/src/components/Scrollbar.mjs +179 -0
- package/dist/core/src/components/ScrollbarBar.mjs +103 -0
- package/dist/core/src/components/Tooltip.mjs +321 -0
- package/dist/core/src/components/VTableGuildConfigProvider.mjs +77 -0
- package/dist/core/src/components/VirtualList/Filler.mjs +55 -0
- package/dist/core/src/components/VirtualList/Item.mjs +29 -0
- package/dist/core/src/components/VirtualList/VirtualList.mjs +373 -0
- package/dist/core/src/components/VirtualList/VirtualScrollBar.mjs +216 -0
- package/dist/core/src/components/VirtualList/hooks/useChildren.mjs +21 -0
- package/dist/core/src/components/VirtualList/hooks/useDiffItem.mjs +16 -0
- package/dist/core/src/components/VirtualList/hooks/useFrameWheel.mjs +48 -0
- package/dist/core/src/components/VirtualList/hooks/useGetSize.mjs +25 -0
- package/dist/core/src/components/VirtualList/hooks/useHeights.mjs +56 -0
- package/dist/core/src/components/VirtualList/hooks/useMobileTouchMove.mjs +40 -0
- package/dist/core/src/components/VirtualList/hooks/useOriginScroll.mjs +17 -0
- package/dist/core/src/components/VirtualList/hooks/useScrollDrag.mjs +41 -0
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.mjs +88 -0
- package/dist/core/src/components/VirtualList/utils/CacheMap.mjs +24 -0
- package/dist/core/src/components/VirtualList/utils/algorithmUtil.mjs +22 -0
- package/dist/core/src/components/VirtualList/utils/isFirefox.mjs +4 -0
- package/dist/core/src/components/VirtualList/utils/scrollbarUtil.mjs +7 -0
- package/dist/core/src/composables/useScrollbar.mjs +55 -0
- package/dist/core/src/composables/useTheme.mjs +92 -0
- package/dist/core/src/index.d.ts +1 -0
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/plugin/index.mjs +27 -0
- package/dist/core/src/utils/classPrefix.mjs +100 -0
- package/dist/core/src/utils/devWarn.d.ts +4 -0
- package/dist/core/src/utils/devWarn.d.ts.map +1 -0
- package/dist/core/src/utils/devWarn.mjs +5 -0
- package/dist/core/src/utils/mergeDeep.mjs +20 -0
- package/dist/core/src/utils/props.mjs +33 -0
- package/dist/core/src/utils/tv.mjs +19 -0
- package/dist/icons/src/AntdvEmptyIcon.mjs +37 -0
- package/dist/icons/src/AntdvSpinIndicator.mjs +23 -0
- package/dist/icons/src/CaretDownIcon.d.ts.map +1 -1
- package/dist/icons/src/CaretDownIcon.mjs +9 -0
- package/dist/icons/src/CaretRightIcon.d.ts.map +1 -1
- package/dist/icons/src/CaretUpIcon.d.ts.map +1 -1
- package/dist/icons/src/CaretUpIcon.mjs +9 -0
- package/dist/icons/src/DownOutlinedIcon.d.ts.map +1 -1
- package/dist/icons/src/DownOutlinedIcon.mjs +9 -0
- package/dist/icons/src/ElArrowDownIcon.d.ts.map +1 -1
- package/dist/icons/src/ElArrowDownIcon.mjs +9 -0
- package/dist/icons/src/ElCaretBottomIcon.d.ts.map +1 -1
- package/dist/icons/src/ElCaretBottomIcon.mjs +9 -0
- package/dist/icons/src/ElCaretTopIcon.d.ts.map +1 -1
- package/dist/icons/src/ElCaretTopIcon.mjs +9 -0
- package/dist/icons/src/ElFilterIcon.d.ts.map +1 -1
- package/dist/icons/src/ElLoadingIcon.mjs +28 -0
- package/dist/icons/src/FilterFilledIcon.d.ts.map +1 -1
- package/dist/icons/src/FilterFilledIcon.mjs +9 -0
- package/dist/icons/src/SearchIcon.d.ts.map +1 -1
- package/dist/icons/src/SearchIcon.mjs +9 -0
- package/dist/icons/src/createSvgIcon.d.ts +13 -0
- package/dist/icons/src/createSvgIcon.d.ts.map +1 -0
- package/dist/icons/src/createSvgIcon.mjs +23 -0
- package/dist/index.mjs +82 -10196
- package/dist/table/src/components/ColGroup.mjs +25 -0
- package/dist/table/src/components/ExpandIcon.mjs +60 -0
- package/dist/table/src/components/FilterDropdown.d.ts.map +1 -1
- package/dist/table/src/components/FilterDropdown.mjs +324 -0
- package/dist/table/src/components/FilterIcon.mjs +30 -0
- package/dist/table/src/components/ResizeHandle.mjs +28 -0
- package/dist/table/src/components/SelectionCheckbox.mjs +33 -0
- package/dist/table/src/components/SelectionDropdown.d.ts.map +1 -1
- package/dist/table/src/components/SelectionDropdown.mjs +73 -0
- package/dist/table/src/components/SelectionRadio.mjs +28 -0
- package/dist/table/src/components/SortButton.mjs +30 -0
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +781 -0
- package/dist/table/src/components/TableBody.mjs +124 -0
- package/dist/table/src/components/TableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableCell.mjs +222 -0
- package/dist/table/src/components/TableEmpty.mjs +38 -0
- package/dist/table/src/components/TableHeader.mjs +51 -0
- package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
- package/dist/table/src/components/TableHeaderCell.mjs +391 -0
- package/dist/table/src/components/TableLoading.mjs +46 -0
- package/dist/table/src/components/TableRow.mjs +34 -0
- package/dist/table/src/components/VTable.vue.d.ts.map +1 -1
- package/dist/table/src/components/VTable.vue.mjs +155 -0
- package/dist/table/src/components/VTable.vue2.mjs +4 -0
- package/dist/table/src/components/VTableSummary.mjs +29 -0
- package/dist/table/src/components/VTableSummaryCell.d.ts.map +1 -1
- package/dist/table/src/components/VTableSummaryCell.mjs +68 -0
- package/dist/table/src/components/VTableSummaryRow.mjs +19 -0
- package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
- package/dist/table/src/components/VirtualTableBody.mjs +172 -0
- package/dist/table/src/composables/index.d.ts +2 -1
- package/dist/table/src/composables/index.d.ts.map +1 -1
- package/dist/table/src/composables/useColumns.d.ts +6 -1
- package/dist/table/src/composables/useColumns.d.ts.map +1 -1
- package/dist/table/src/composables/useColumns.mjs +81 -0
- package/dist/table/src/composables/useControlledColumnState.d.ts +24 -0
- package/dist/table/src/composables/useControlledColumnState.d.ts.map +1 -0
- package/dist/table/src/composables/useControlledColumnState.mjs +23 -0
- package/dist/table/src/composables/useExpand.mjs +37 -0
- package/dist/table/src/composables/useFilter.d.ts.map +1 -1
- package/dist/table/src/composables/useFilter.mjs +68 -0
- package/dist/table/src/composables/useFixedColumnStyle.d.ts +18 -0
- package/dist/table/src/composables/useFixedColumnStyle.d.ts.map +1 -0
- package/dist/table/src/composables/useFixedColumnStyle.mjs +21 -0
- package/dist/table/src/composables/useHoverState.mjs +26 -0
- package/dist/table/src/composables/useResize.mjs +42 -0
- package/dist/table/src/composables/useScroll.d.ts +5 -4
- package/dist/table/src/composables/useScroll.d.ts.map +1 -1
- package/dist/table/src/composables/useScroll.mjs +68 -0
- package/dist/table/src/composables/useSelection.d.ts.map +1 -1
- package/dist/table/src/composables/useSelection.mjs +246 -0
- package/dist/table/src/composables/useSorter.d.ts +1 -5
- package/dist/table/src/composables/useSorter.d.ts.map +1 -1
- package/dist/table/src/composables/useSorter.mjs +161 -0
- package/dist/table/src/composables/useTreeData.d.ts +2 -0
- package/dist/table/src/composables/useTreeData.d.ts.map +1 -1
- package/dist/table/src/composables/useTreeData.mjs +92 -0
- package/dist/table/src/composables/useVirtual.mjs +19 -0
- package/dist/table/src/constants.mjs +8 -0
- package/dist/table/src/context.d.ts +90 -85
- package/dist/table/src/context.d.ts.map +1 -1
- package/dist/table/src/context.mjs +4 -0
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/index.mjs +23 -0
- package/dist/table/src/preset-config.mjs +35 -0
- package/dist/table/src/utils/cell.mjs +79 -0
- package/dist/table/src/utils/popupPosition.d.ts +20 -0
- package/dist/table/src/utils/popupPosition.d.ts.map +1 -0
- package/dist/table/src/utils/popupPosition.mjs +24 -0
- package/dist/table/src/utils/popupPosition.test.d.ts +2 -0
- package/dist/table/src/utils/popupPosition.test.d.ts.map +1 -0
- package/dist/table/src/utils/vnode.mjs +10 -0
- package/dist/theme/src/presets/antdv/button.mjs +70 -0
- package/dist/theme/src/presets/antdv/checkbox.mjs +51 -0
- package/dist/theme/src/presets/antdv/input.mjs +40 -0
- package/dist/theme/src/presets/antdv/radio.mjs +34 -0
- package/dist/theme/src/presets/antdv/scrollbar.mjs +22 -0
- package/dist/theme/src/presets/antdv/table-locale.mjs +55 -0
- package/dist/theme/src/presets/antdv/table.mjs +285 -0
- package/dist/theme/src/presets/antdv/tooltip.mjs +20 -0
- package/dist/theme/src/presets/element-plus/button.mjs +70 -0
- package/dist/theme/src/presets/element-plus/checkbox.mjs +65 -0
- package/dist/theme/src/presets/element-plus/input.mjs +39 -0
- package/dist/theme/src/presets/element-plus/radio.mjs +34 -0
- package/dist/theme/src/presets/element-plus/scrollbar.mjs +22 -0
- package/dist/theme/src/presets/element-plus/table-locale.mjs +56 -0
- package/dist/theme/src/presets/element-plus/table.mjs +235 -0
- package/dist/theme/src/presets/element-plus/tooltip.mjs +21 -0
- package/dist/theme/src/presets/index.mjs +92 -0
- package/package.json +5 -2
- package/dist/index.cjs +0 -1
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import He from "./Filler.mjs";
|
|
2
|
+
import Me from "./hooks/useChildren.mjs";
|
|
3
|
+
import be from "./hooks/useDiffItem.mjs";
|
|
4
|
+
import Re from "./hooks/useFrameWheel.mjs";
|
|
5
|
+
import { useGetSize as ze } from "./hooks/useGetSize.mjs";
|
|
6
|
+
import Be from "./hooks/useHeights.mjs";
|
|
7
|
+
import Te from "./hooks/useMobileTouchMove.mjs";
|
|
8
|
+
import we from "./hooks/useScrollDrag.mjs";
|
|
9
|
+
import Ce from "./hooks/useScrollTo.mjs";
|
|
10
|
+
import oe from "./VirtualScrollBar.mjs";
|
|
11
|
+
import { getSpinSize as ne } from "./utils/scrollbarUtil.mjs";
|
|
12
|
+
import { defineComponent as Ie, computed as M, watch as B, shallowRef as U, ref as u, unref as Ve, toRaw as Ae, onBeforeUnmount as We, createVNode as P } from "vue";
|
|
13
|
+
const ie = [], Le = {
|
|
14
|
+
overflowY: "auto",
|
|
15
|
+
overflowAnchor: "none"
|
|
16
|
+
};
|
|
17
|
+
function Fe(t) {
|
|
18
|
+
const s = {};
|
|
19
|
+
for (const c of Object.keys(t))
|
|
20
|
+
c.startsWith("on") || (s[c] = t[c]);
|
|
21
|
+
return s;
|
|
22
|
+
}
|
|
23
|
+
function re(t, s) {
|
|
24
|
+
let c = 0, T = t.length - 1, w = t.length;
|
|
25
|
+
for (; c <= T; ) {
|
|
26
|
+
const y = Math.floor((c + T) / 2);
|
|
27
|
+
t[y] >= s ? (w = y, T = y - 1) : c = y + 1;
|
|
28
|
+
}
|
|
29
|
+
return w;
|
|
30
|
+
}
|
|
31
|
+
function Ke(t) {
|
|
32
|
+
const {
|
|
33
|
+
dataLength: s,
|
|
34
|
+
offsetTop: c,
|
|
35
|
+
height: T,
|
|
36
|
+
itemHeight: w,
|
|
37
|
+
getItemHeight: y
|
|
38
|
+
} = t, f = new Array(s);
|
|
39
|
+
let L = 0;
|
|
40
|
+
for (let o = 0; o < s; o += 1)
|
|
41
|
+
L += y(o) ?? w, f[o] = L;
|
|
42
|
+
let b = re(f, c);
|
|
43
|
+
b >= s && (b = 0);
|
|
44
|
+
const x = c + T;
|
|
45
|
+
let C = re(f, x + 1);
|
|
46
|
+
return C >= s && (C = s - 1), C = Math.min(C + 1, s - 1), {
|
|
47
|
+
scrollHeight: L,
|
|
48
|
+
start: b,
|
|
49
|
+
end: C,
|
|
50
|
+
offset: b === 0 ? 0 : f[b - 1]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const qe = /* @__PURE__ */ Ie({
|
|
54
|
+
name: "VirtualList",
|
|
55
|
+
props: {
|
|
56
|
+
prefixCls: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "vtg-virtual-list"
|
|
59
|
+
},
|
|
60
|
+
data: {
|
|
61
|
+
type: Array
|
|
62
|
+
},
|
|
63
|
+
height: Number,
|
|
64
|
+
itemHeight: Number,
|
|
65
|
+
fullHeight: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: !0
|
|
68
|
+
},
|
|
69
|
+
itemKey: {
|
|
70
|
+
type: [String, Number, Function],
|
|
71
|
+
required: !0
|
|
72
|
+
},
|
|
73
|
+
component: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: "div"
|
|
76
|
+
},
|
|
77
|
+
direction: {
|
|
78
|
+
type: String
|
|
79
|
+
},
|
|
80
|
+
scrollWidth: Number,
|
|
81
|
+
styles: Object,
|
|
82
|
+
showScrollBar: {
|
|
83
|
+
type: [Boolean, String],
|
|
84
|
+
default: "optional"
|
|
85
|
+
},
|
|
86
|
+
virtual: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: !0
|
|
89
|
+
},
|
|
90
|
+
onScroll: Function,
|
|
91
|
+
onVirtualScroll: Function,
|
|
92
|
+
onVisibleChange: Function,
|
|
93
|
+
innerProps: Object,
|
|
94
|
+
extraRender: Function
|
|
95
|
+
},
|
|
96
|
+
inheritAttrs: !1,
|
|
97
|
+
setup(t, {
|
|
98
|
+
expose: s,
|
|
99
|
+
attrs: c,
|
|
100
|
+
slots: T
|
|
101
|
+
}) {
|
|
102
|
+
const w = M(() => t.itemHeight);
|
|
103
|
+
let y = t.itemKey;
|
|
104
|
+
B(() => t.itemKey, (e) => {
|
|
105
|
+
y = e;
|
|
106
|
+
});
|
|
107
|
+
const f = (e) => {
|
|
108
|
+
const l = y;
|
|
109
|
+
return typeof l == "function" ? l(e) : e?.[l];
|
|
110
|
+
}, [L, b, x, C] = Be(f), o = U(t?.data || ie);
|
|
111
|
+
B(() => t.data, () => {
|
|
112
|
+
o.value = t?.data || ie;
|
|
113
|
+
});
|
|
114
|
+
const F = M(() => !!(t.virtual !== !1 && t.height && t.itemHeight)), v = M(() => {
|
|
115
|
+
const e = o.value;
|
|
116
|
+
return F.value && e && (t.itemHeight * e.length > t.height || !!t.scrollWidth);
|
|
117
|
+
}), R = u(), _ = u(), q = u(), k = u(!1), G = U(), J = U(), h = u(0), i = u(0), $ = u(!1), Q = u(0), Z = u(0), g = u(t.scrollWidth || 0), r = u(0), m = u(0), H = u(0), I = u(void 0);
|
|
118
|
+
function V(e) {
|
|
119
|
+
let l;
|
|
120
|
+
typeof e == "function" ? l = e(h.value) : l = e;
|
|
121
|
+
const a = r.value - t.height, n = Math.max(0, Math.min(l, a || 0));
|
|
122
|
+
R.value && (R.value.scrollTop = n), h.value = n;
|
|
123
|
+
}
|
|
124
|
+
B([v, F, h, o, C, () => t.height], () => {
|
|
125
|
+
if (!F.value) {
|
|
126
|
+
r.value = 0, m.value = 0, H.value = o.value.length - 1, I.value = void 0;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (!v.value) {
|
|
130
|
+
r.value = _.value?.offsetHeight || 0, m.value = 0, H.value = o.value.length - 1, I.value = void 0;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const {
|
|
134
|
+
itemHeight: e,
|
|
135
|
+
height: l
|
|
136
|
+
} = t, a = o.value.length;
|
|
137
|
+
if (!a) {
|
|
138
|
+
r.value = 0, m.value = 0, H.value = -1, I.value = 0;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (Ve(x.id) === 0) {
|
|
142
|
+
const z = e, ye = l, X = Math.max(0, Math.floor(h.value / z)), xe = X * z;
|
|
143
|
+
let Y = X + Math.ceil(ye / z);
|
|
144
|
+
Y = Math.min(Y + 1, a - 1), r.value = a * z, m.value = X, H.value = Y, I.value = xe;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const n = Ae(o.value), W = Ke({
|
|
148
|
+
dataLength: a,
|
|
149
|
+
offsetTop: h.value,
|
|
150
|
+
height: l,
|
|
151
|
+
itemHeight: e,
|
|
152
|
+
getItemHeight(z) {
|
|
153
|
+
return x.get(f(n[z]));
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
r.value = W.scrollHeight, m.value = W.start, H.value = W.end, I.value = W.offset;
|
|
157
|
+
}, {
|
|
158
|
+
immediate: !0
|
|
159
|
+
}), B(r, () => {
|
|
160
|
+
const e = x.getRecord();
|
|
161
|
+
if (e.size === 1) {
|
|
162
|
+
const l = Array.from(e.keys())[0], a = e.get(l), n = o.value[m.value];
|
|
163
|
+
if (n && a === void 0 && f(n) === l) {
|
|
164
|
+
const W = x.get(l) - t.itemHeight;
|
|
165
|
+
V((z) => z + W);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (F.value && t.height) {
|
|
169
|
+
const l = Math.max(0, r.value - t.height);
|
|
170
|
+
h.value > l && V(l);
|
|
171
|
+
}
|
|
172
|
+
x.resetRecord();
|
|
173
|
+
});
|
|
174
|
+
const S = u({
|
|
175
|
+
width: 0,
|
|
176
|
+
height: t.height || 0
|
|
177
|
+
});
|
|
178
|
+
let A = null, K = null;
|
|
179
|
+
const ue = (e) => {
|
|
180
|
+
K !== e && (A && K && A.unobserve(K), K = e, e && (A || (A = new ResizeObserver((l) => {
|
|
181
|
+
const a = l[0];
|
|
182
|
+
if (a) {
|
|
183
|
+
const n = a.target;
|
|
184
|
+
S.value = {
|
|
185
|
+
width: n.offsetWidth,
|
|
186
|
+
height: n.offsetHeight
|
|
187
|
+
}, g.value = t.scrollWidth ?? n.offsetWidth;
|
|
188
|
+
}
|
|
189
|
+
})), A.observe(e)));
|
|
190
|
+
};
|
|
191
|
+
We(() => {
|
|
192
|
+
A?.disconnect(), A = null, K = null;
|
|
193
|
+
});
|
|
194
|
+
const d = M(() => t.direction === "rtl"), D = () => ({
|
|
195
|
+
x: d.value ? -i.value : i.value,
|
|
196
|
+
y: h.value
|
|
197
|
+
}), E = u(D()), j = (e) => {
|
|
198
|
+
if (t.onVirtualScroll) {
|
|
199
|
+
const l = {
|
|
200
|
+
...D(),
|
|
201
|
+
...e
|
|
202
|
+
};
|
|
203
|
+
(E.value.x !== l.x || E.value.y !== l.y) && (t.onVirtualScroll(l), E.value = l);
|
|
204
|
+
}
|
|
205
|
+
}, O = M(() => Math.max(0, (g.value || 0) - S.value.width)), ce = M(() => h.value === 0), se = M(() => h.value + t.height >= r.value), ve = M(() => i.value === 0), he = M(() => i.value >= O.value), N = (e) => Math.max(0, Math.min(e, O.value)), p = () => {
|
|
206
|
+
G.value?.delayHidden(), J.value?.delayHidden();
|
|
207
|
+
}, [fe] = Re(v, ce, se, ve, he, O.value > 0, (e, l) => {
|
|
208
|
+
if (l) {
|
|
209
|
+
const a = N(d.value ? i.value - e : i.value + e);
|
|
210
|
+
i.value = a, j({
|
|
211
|
+
x: d.value ? -a : a
|
|
212
|
+
});
|
|
213
|
+
} else
|
|
214
|
+
V((a) => a + e);
|
|
215
|
+
});
|
|
216
|
+
Te(v, R, (e, l) => {
|
|
217
|
+
if (e) {
|
|
218
|
+
const a = N(d.value ? i.value - l : i.value + l);
|
|
219
|
+
return i.value = a, j({
|
|
220
|
+
x: d.value ? -a : a
|
|
221
|
+
}), !0;
|
|
222
|
+
} else
|
|
223
|
+
return V((a) => a + l), !0;
|
|
224
|
+
}), we(v, R, (e) => {
|
|
225
|
+
V((l) => l + e);
|
|
226
|
+
});
|
|
227
|
+
const ee = (e, l) => {
|
|
228
|
+
l ? (i.value = e, j({
|
|
229
|
+
x: d.value ? -e : e
|
|
230
|
+
})) : V(e);
|
|
231
|
+
}, te = () => {
|
|
232
|
+
$.value = !0;
|
|
233
|
+
}, le = () => {
|
|
234
|
+
$.value = !1;
|
|
235
|
+
};
|
|
236
|
+
be(o, f), B([() => t.height, r, v, () => S.value.height], () => {
|
|
237
|
+
v.value && t.height && r.value && (Q.value = ne(S.value.height, r.value));
|
|
238
|
+
}, {
|
|
239
|
+
immediate: !0
|
|
240
|
+
}), B([() => S.value.width, g], () => {
|
|
241
|
+
v.value && g.value && (Z.value = ne(S.value.width, g.value));
|
|
242
|
+
}, {
|
|
243
|
+
immediate: !0
|
|
244
|
+
}), B(() => t.scrollWidth, (e) => {
|
|
245
|
+
g.value = e ?? S.value.width, i.value = N(i.value);
|
|
246
|
+
}, {
|
|
247
|
+
immediate: !0
|
|
248
|
+
});
|
|
249
|
+
function de(e) {
|
|
250
|
+
const l = e.currentTarget.scrollTop;
|
|
251
|
+
!F.value || !v.value ? h.value = l : l !== h.value && V(l), t.onScroll?.(e), j();
|
|
252
|
+
}
|
|
253
|
+
const [ae, ge] = Ce(R, o, x, w, f, () => b(!0), (e) => {
|
|
254
|
+
const l = ge(), a = Math.max(r.value, l) - t.height, n = Math.max(0, Math.min(e, a || 0));
|
|
255
|
+
R.value && (R.value.scrollTop = n), h.value = n;
|
|
256
|
+
}, p);
|
|
257
|
+
s({
|
|
258
|
+
nativeElement: q,
|
|
259
|
+
getScrollInfo: D,
|
|
260
|
+
getHorizontalRange: () => O.value,
|
|
261
|
+
scrollTo: (e) => {
|
|
262
|
+
function l(a) {
|
|
263
|
+
return a && typeof a == "object" && ("left" in a || "top" in a);
|
|
264
|
+
}
|
|
265
|
+
l(e) ? (e.left !== void 0 && (i.value = N(e.left)), ae(e.top)) : ae(e);
|
|
266
|
+
}
|
|
267
|
+
}), B([m, H, o], () => {
|
|
268
|
+
if (t.onVisibleChange) {
|
|
269
|
+
const e = o.value.slice(m.value, H.value + 1);
|
|
270
|
+
t.onVisibleChange(e, o.value);
|
|
271
|
+
}
|
|
272
|
+
}, {
|
|
273
|
+
flush: "post"
|
|
274
|
+
});
|
|
275
|
+
const me = ze(o, f, x, w), Se = Me(o, m, H, g, i, L, (e, l, a) => T.default?.({
|
|
276
|
+
item: e,
|
|
277
|
+
index: l,
|
|
278
|
+
...a
|
|
279
|
+
}), {
|
|
280
|
+
getKey: f
|
|
281
|
+
});
|
|
282
|
+
return () => {
|
|
283
|
+
const e = {};
|
|
284
|
+
t.height && (e[t.fullHeight ? "height" : "maxHeight"] = `${t.height}px`, Object.assign(e, Le), v.value && (e.overflowY = "hidden", O.value > 0 && (e.overflowX = "hidden"), $.value && (e.pointerEvents = "none")));
|
|
285
|
+
const l = t.extraRender?.({
|
|
286
|
+
start: m.value,
|
|
287
|
+
end: H.value,
|
|
288
|
+
virtual: v.value,
|
|
289
|
+
offsetX: i.value,
|
|
290
|
+
offsetY: I.value || 0,
|
|
291
|
+
rtl: d.value,
|
|
292
|
+
getSize: me
|
|
293
|
+
}), a = t.component;
|
|
294
|
+
return P("div", {
|
|
295
|
+
ref: q,
|
|
296
|
+
...Fe(c),
|
|
297
|
+
style: {
|
|
298
|
+
position: "relative",
|
|
299
|
+
...c.style
|
|
300
|
+
},
|
|
301
|
+
dir: d.value ? "rtl" : void 0,
|
|
302
|
+
class: [t.prefixCls, {
|
|
303
|
+
[`${t.prefixCls}-rtl`]: d.value
|
|
304
|
+
}, c.class],
|
|
305
|
+
onMouseenter: () => {
|
|
306
|
+
k.value = !0;
|
|
307
|
+
},
|
|
308
|
+
onMouseleave: () => {
|
|
309
|
+
k.value = !1;
|
|
310
|
+
}
|
|
311
|
+
}, [P(a, {
|
|
312
|
+
class: `${t.prefixCls}-holder`,
|
|
313
|
+
style: e,
|
|
314
|
+
ref: (n) => {
|
|
315
|
+
R.value = n?.$el ?? n, ue(n?.$el ?? n);
|
|
316
|
+
},
|
|
317
|
+
onScroll: de,
|
|
318
|
+
onWheel: fe,
|
|
319
|
+
onMouseenter: p
|
|
320
|
+
}, {
|
|
321
|
+
default: () => [P(He, {
|
|
322
|
+
prefixCls: t.prefixCls,
|
|
323
|
+
height: r.value,
|
|
324
|
+
offsetX: i.value,
|
|
325
|
+
offsetY: I.value,
|
|
326
|
+
scrollWidth: g.value,
|
|
327
|
+
onInnerResize: b,
|
|
328
|
+
ref: _,
|
|
329
|
+
innerProps: t.innerProps,
|
|
330
|
+
rtl: d.value,
|
|
331
|
+
extra: l
|
|
332
|
+
}, {
|
|
333
|
+
default: () => [Se.value]
|
|
334
|
+
})]
|
|
335
|
+
}), v.value && r.value > (t.height || 0) && P(oe, {
|
|
336
|
+
ref: G,
|
|
337
|
+
prefixCls: t.prefixCls,
|
|
338
|
+
scrollOffset: h.value,
|
|
339
|
+
scrollRange: r.value,
|
|
340
|
+
rtl: d.value,
|
|
341
|
+
onScroll: ee,
|
|
342
|
+
onStartMove: te,
|
|
343
|
+
onStopMove: le,
|
|
344
|
+
spinSize: Q.value,
|
|
345
|
+
containerSize: S.value.height,
|
|
346
|
+
active: k.value,
|
|
347
|
+
showScrollBar: t.showScrollBar,
|
|
348
|
+
style: t.styles?.verticalScrollBar,
|
|
349
|
+
thumbStyle: t.styles?.verticalScrollBarThumb
|
|
350
|
+
}), v.value && g.value > S.value.width && P(oe, {
|
|
351
|
+
ref: J,
|
|
352
|
+
prefixCls: t.prefixCls,
|
|
353
|
+
scrollOffset: i.value,
|
|
354
|
+
scrollRange: g.value,
|
|
355
|
+
rtl: d.value,
|
|
356
|
+
onScroll: ee,
|
|
357
|
+
onStartMove: te,
|
|
358
|
+
onStopMove: le,
|
|
359
|
+
spinSize: Z.value,
|
|
360
|
+
containerSize: S.value.width,
|
|
361
|
+
horizontal: !0,
|
|
362
|
+
active: k.value,
|
|
363
|
+
showScrollBar: t.showScrollBar,
|
|
364
|
+
style: t.styles?.horizontalScrollBar,
|
|
365
|
+
thumbStyle: t.styles?.horizontalScrollBarThumb
|
|
366
|
+
})]);
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
export {
|
|
371
|
+
qe as default,
|
|
372
|
+
Ke as getMeasuredVisibleRange
|
|
373
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { defineComponent as H, ref as v, computed as d, shallowRef as T, watch as R, onMounted as _, onUnmounted as k, createVNode as j } from "vue";
|
|
2
|
+
function C(e, f) {
|
|
3
|
+
return ("touches" in e ? e.touches[0] : e)[f ? "pageX" : "pageY"] - window[f ? "scrollX" : "scrollY"];
|
|
4
|
+
}
|
|
5
|
+
const I = /* @__PURE__ */ H({
|
|
6
|
+
name: "VirtualScrollBar",
|
|
7
|
+
props: {
|
|
8
|
+
prefixCls: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: !0
|
|
11
|
+
},
|
|
12
|
+
scrollOffset: {
|
|
13
|
+
type: Number,
|
|
14
|
+
required: !0
|
|
15
|
+
},
|
|
16
|
+
scrollRange: {
|
|
17
|
+
type: Number,
|
|
18
|
+
required: !0
|
|
19
|
+
},
|
|
20
|
+
rtl: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
required: !0
|
|
23
|
+
},
|
|
24
|
+
onScroll: {
|
|
25
|
+
type: Function,
|
|
26
|
+
required: !0
|
|
27
|
+
},
|
|
28
|
+
onStartMove: {
|
|
29
|
+
type: Function,
|
|
30
|
+
required: !0
|
|
31
|
+
},
|
|
32
|
+
onStopMove: {
|
|
33
|
+
type: Function,
|
|
34
|
+
required: !0
|
|
35
|
+
},
|
|
36
|
+
horizontal: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: void 0
|
|
39
|
+
},
|
|
40
|
+
style: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: void 0
|
|
43
|
+
},
|
|
44
|
+
thumbStyle: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default: void 0
|
|
47
|
+
},
|
|
48
|
+
spinSize: {
|
|
49
|
+
type: Number,
|
|
50
|
+
required: !0
|
|
51
|
+
},
|
|
52
|
+
containerSize: {
|
|
53
|
+
type: Number,
|
|
54
|
+
required: !0
|
|
55
|
+
},
|
|
56
|
+
active: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: !1
|
|
59
|
+
},
|
|
60
|
+
showScrollBar: {
|
|
61
|
+
type: [Boolean, String],
|
|
62
|
+
default: void 0
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
setup(e, {
|
|
66
|
+
expose: f
|
|
67
|
+
}) {
|
|
68
|
+
const n = v(!1), m = v(!1), h = v(null), g = v(null), b = d(() => !e.rtl), w = T(), L = T(), S = v(e.showScrollBar === !0 || e.showScrollBar === "optional");
|
|
69
|
+
let i = null;
|
|
70
|
+
const y = () => {
|
|
71
|
+
e.showScrollBar === !0 || e.showScrollBar === !1 || e.showScrollBar === "hover" || (i && clearTimeout(i), S.value = !0, i = setTimeout(() => {
|
|
72
|
+
S.value = !1;
|
|
73
|
+
}, 3e3));
|
|
74
|
+
}, p = d(() => e.showScrollBar === !0 ? !0 : e.showScrollBar === !1 ? !1 : e.showScrollBar === "hover" ? e.active || n.value : S.value || n.value), M = d(() => e.scrollRange - e.containerSize || 0), x = d(() => e.containerSize - e.spinSize || 0), s = d(() => e.scrollOffset === 0 || M.value === 0 ? 0 : e.scrollOffset / M.value * x.value), E = T({
|
|
75
|
+
top: s.value,
|
|
76
|
+
dragging: n.value,
|
|
77
|
+
pageY: h.value,
|
|
78
|
+
startTop: g.value
|
|
79
|
+
});
|
|
80
|
+
R([s, n, h, g], () => {
|
|
81
|
+
E.value = {
|
|
82
|
+
top: s.value,
|
|
83
|
+
dragging: n.value,
|
|
84
|
+
pageY: h.value,
|
|
85
|
+
startTop: g.value
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
const D = (t) => {
|
|
89
|
+
t.stopPropagation(), t.preventDefault();
|
|
90
|
+
}, B = (t) => {
|
|
91
|
+
n.value = !0, h.value = C(t, e.horizontal || !1), g.value = E.value.top, e.onStartMove?.(), t.stopPropagation(), t.preventDefault();
|
|
92
|
+
};
|
|
93
|
+
return _(() => {
|
|
94
|
+
const t = (a) => {
|
|
95
|
+
a.preventDefault();
|
|
96
|
+
}, l = w.value, o = L.value;
|
|
97
|
+
l && o && (l.addEventListener("touchstart", t, {
|
|
98
|
+
passive: !1
|
|
99
|
+
}), o.addEventListener("touchstart", B, {
|
|
100
|
+
passive: !1
|
|
101
|
+
}), k(() => {
|
|
102
|
+
l.removeEventListener("touchstart", t), o.removeEventListener("touchstart", B);
|
|
103
|
+
}));
|
|
104
|
+
}), R(n, (t, l, o) => {
|
|
105
|
+
if (t) {
|
|
106
|
+
let a = null;
|
|
107
|
+
const r = (F) => {
|
|
108
|
+
const {
|
|
109
|
+
dragging: N,
|
|
110
|
+
pageY: P,
|
|
111
|
+
startTop: V
|
|
112
|
+
} = E.value;
|
|
113
|
+
a !== null && cancelAnimationFrame(a);
|
|
114
|
+
const O = w.value.getBoundingClientRect(), X = e.containerSize / (e.horizontal ? O.width : O.height);
|
|
115
|
+
if (N) {
|
|
116
|
+
const q = (C(F, e.horizontal || !1) - (P || 0)) * X;
|
|
117
|
+
let z = V || 0;
|
|
118
|
+
!b.value && e.horizontal ? z -= q : z += q;
|
|
119
|
+
const $ = M.value, Y = x.value, A = Y ? z / Y : 0;
|
|
120
|
+
let c = Math.ceil(A * $);
|
|
121
|
+
c = Math.max(c, 0), c = Math.min(c, $), a = requestAnimationFrame(() => {
|
|
122
|
+
e.onScroll?.(c, e.horizontal);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}, u = () => {
|
|
126
|
+
n.value = !1, e.onStopMove();
|
|
127
|
+
};
|
|
128
|
+
window.addEventListener("mousemove", r, {
|
|
129
|
+
passive: !0
|
|
130
|
+
}), window.addEventListener("touchmove", r, {
|
|
131
|
+
passive: !0
|
|
132
|
+
}), window.addEventListener("mouseup", u, {
|
|
133
|
+
passive: !0
|
|
134
|
+
}), window.addEventListener("touchend", u, {
|
|
135
|
+
passive: !0
|
|
136
|
+
}), o(() => {
|
|
137
|
+
window.removeEventListener("mousemove", r), window.removeEventListener("touchmove", r), window.removeEventListener("mouseup", u), window.removeEventListener("touchend", u), a !== null && cancelAnimationFrame(a);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}), R(() => e.scrollOffset, (t, l, o) => {
|
|
141
|
+
y(), o(() => {
|
|
142
|
+
i && clearTimeout(i);
|
|
143
|
+
});
|
|
144
|
+
}), f({
|
|
145
|
+
delayHidden: y
|
|
146
|
+
}), () => {
|
|
147
|
+
const {
|
|
148
|
+
prefixCls: t,
|
|
149
|
+
horizontal: l
|
|
150
|
+
} = e, o = `${t}-scrollbar`, a = m.value || n.value, r = {
|
|
151
|
+
position: "absolute",
|
|
152
|
+
opacity: p.value ? 1 : 0,
|
|
153
|
+
pointerEvents: p.value ? void 0 : "none",
|
|
154
|
+
transition: "opacity 300ms"
|
|
155
|
+
}, u = {
|
|
156
|
+
position: "absolute",
|
|
157
|
+
borderRadius: "var(--vtg-scrollbar-thumb-radius, 3px)",
|
|
158
|
+
background: a ? "var(--vtg-scrollbar-thumb-hover-bg, rgb(0 0 0 / 25%))" : "var(--vtg-scrollbar-thumb-bg, rgb(0 0 0 / 15%))",
|
|
159
|
+
cursor: "pointer",
|
|
160
|
+
userSelect: "none",
|
|
161
|
+
transition: "background-color 200ms"
|
|
162
|
+
};
|
|
163
|
+
return l ? (Object.assign(r, {
|
|
164
|
+
height: "var(--vtg-scrollbar-thumb-width, 6px)",
|
|
165
|
+
left: 0,
|
|
166
|
+
right: 0,
|
|
167
|
+
bottom: 0
|
|
168
|
+
}), Object.assign(u, {
|
|
169
|
+
height: "100%",
|
|
170
|
+
width: `${e.spinSize}px`,
|
|
171
|
+
[b.value ? "left" : "right"]: `${s.value}px`
|
|
172
|
+
})) : (Object.assign(r, {
|
|
173
|
+
width: "var(--vtg-scrollbar-thumb-width, 6px)",
|
|
174
|
+
top: 0,
|
|
175
|
+
bottom: 0,
|
|
176
|
+
[b.value ? "right" : "left"]: 0
|
|
177
|
+
}), Object.assign(u, {
|
|
178
|
+
width: "100%",
|
|
179
|
+
height: `${e.spinSize}px`,
|
|
180
|
+
top: `${s.value}px`
|
|
181
|
+
})), j("div", {
|
|
182
|
+
ref: w,
|
|
183
|
+
class: [o, {
|
|
184
|
+
[`${o}-horizontal`]: l,
|
|
185
|
+
[`${o}-vertical`]: !l,
|
|
186
|
+
[`${o}-visible`]: p.value
|
|
187
|
+
}],
|
|
188
|
+
style: {
|
|
189
|
+
...r,
|
|
190
|
+
...e.style
|
|
191
|
+
},
|
|
192
|
+
onMousedown: D,
|
|
193
|
+
onMousemove: y
|
|
194
|
+
}, [j("div", {
|
|
195
|
+
ref: L,
|
|
196
|
+
class: [`${o}-thumb`, {
|
|
197
|
+
[`${o}-thumb-moving`]: n.value
|
|
198
|
+
}],
|
|
199
|
+
style: {
|
|
200
|
+
...u,
|
|
201
|
+
...e.thumbStyle
|
|
202
|
+
},
|
|
203
|
+
onMousedown: B,
|
|
204
|
+
onMouseenter: () => {
|
|
205
|
+
m.value = !0;
|
|
206
|
+
},
|
|
207
|
+
onMouseleave: () => {
|
|
208
|
+
m.value = !1;
|
|
209
|
+
}
|
|
210
|
+
})]);
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
export {
|
|
215
|
+
I as default
|
|
216
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import s from "../Item.mjs";
|
|
2
|
+
import { computed as v, createVNode as m, isVNode as y } from "vue";
|
|
3
|
+
function b(e) {
|
|
4
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !y(e);
|
|
5
|
+
}
|
|
6
|
+
function N(e, u, r, l, n, c, a, { getKey: f }) {
|
|
7
|
+
return v(() => e.value.slice(u.value, r.value + 1).map((t, i) => {
|
|
8
|
+
const o = a(t, u.value + i, {
|
|
9
|
+
style: { width: `${l.value}px` },
|
|
10
|
+
offsetX: n.value
|
|
11
|
+
}), p = f(t);
|
|
12
|
+
return m(
|
|
13
|
+
s,
|
|
14
|
+
{ key: p, setRef: (d) => c(t, d) },
|
|
15
|
+
b(o) ? o : { default: () => [o] }
|
|
16
|
+
);
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
N as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { findListDiffIndex as r } from "../utils/algorithmUtil.mjs";
|
|
2
|
+
import { shallowRef as n, watch as l } from "vue";
|
|
3
|
+
function v(e, u, m) {
|
|
4
|
+
const f = n(e.value), i = n();
|
|
5
|
+
return l(
|
|
6
|
+
e,
|
|
7
|
+
(t) => {
|
|
8
|
+
const o = r(f.value || [], e.value || [], u);
|
|
9
|
+
o?.index !== void 0 && (i.value = t[o.index]), f.value = t;
|
|
10
|
+
},
|
|
11
|
+
{ immediate: !0 }
|
|
12
|
+
), i;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
v as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import h from "../utils/isFirefox.mjs";
|
|
2
|
+
import y from "./useOriginScroll.mjs";
|
|
3
|
+
import { ref as u, onUnmounted as W } from "vue";
|
|
4
|
+
function _(c, d, p, x, A, D, m) {
|
|
5
|
+
const r = u(0);
|
|
6
|
+
let t = null;
|
|
7
|
+
const v = u(null), F = u(!1), b = y(
|
|
8
|
+
d,
|
|
9
|
+
p,
|
|
10
|
+
x,
|
|
11
|
+
A
|
|
12
|
+
);
|
|
13
|
+
function g(e, l) {
|
|
14
|
+
if (t && cancelAnimationFrame(t), b(!1, l)) return;
|
|
15
|
+
const a = e;
|
|
16
|
+
if (!a._virtualHandled) a._virtualHandled = !0;
|
|
17
|
+
else return;
|
|
18
|
+
r.value += l, v.value = l, h || e.preventDefault(), t = requestAnimationFrame(() => {
|
|
19
|
+
const o = F.value ? 10 : 1;
|
|
20
|
+
m(r.value * o, !1), r.value = 0;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function M(e, l) {
|
|
24
|
+
m(l, !0), h || e.preventDefault();
|
|
25
|
+
}
|
|
26
|
+
const n = u(null);
|
|
27
|
+
let i = null;
|
|
28
|
+
function R(e) {
|
|
29
|
+
if (!c.value) return;
|
|
30
|
+
i && cancelAnimationFrame(i), i = requestAnimationFrame(() => {
|
|
31
|
+
n.value = null;
|
|
32
|
+
});
|
|
33
|
+
const { deltaX: l, deltaY: a, shiftKey: o } = e;
|
|
34
|
+
let f = l, s = a;
|
|
35
|
+
(n.value === "sx" || !n.value && o && a && !l) && (f = a, s = 0, n.value = "sx");
|
|
36
|
+
const X = Math.abs(f), w = Math.abs(s);
|
|
37
|
+
n.value === null && (n.value = D && X > w ? "x" : "y"), n.value === "y" ? g(e, s) : M(e, f);
|
|
38
|
+
}
|
|
39
|
+
function S(e) {
|
|
40
|
+
c.value && (F.value = e.detail === v.value);
|
|
41
|
+
}
|
|
42
|
+
return W(() => {
|
|
43
|
+
t && cancelAnimationFrame(t), i && cancelAnimationFrame(i);
|
|
44
|
+
}), [R, S];
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
_ as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { watch as g } from "vue";
|
|
2
|
+
function k(c, a, v, d) {
|
|
3
|
+
let o = /* @__PURE__ */ new Map(), t = [];
|
|
4
|
+
return g([c, () => v.id.value, d], () => {
|
|
5
|
+
o = /* @__PURE__ */ new Map(), t = [];
|
|
6
|
+
}), (u, f = u) => {
|
|
7
|
+
let n = o.get(u), i = o.get(f);
|
|
8
|
+
if (n === void 0 || i === void 0) {
|
|
9
|
+
const r = c.value.length;
|
|
10
|
+
for (let e = t.length; e < r; e += 1) {
|
|
11
|
+
const s = c.value[e], l = a(s);
|
|
12
|
+
o.set(l, e);
|
|
13
|
+
const p = v.get(l) ?? d.value ?? 0;
|
|
14
|
+
if (t[e] = (t[e - 1] || 0) + p, l === u && (n = e), l === f && (i = e), n !== void 0 && i !== void 0) break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
top: t[(n ?? 0) - 1] || 0,
|
|
19
|
+
bottom: t[i ?? 0]
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
k as useGetSize
|
|
25
|
+
};
|