@king-one/antdv 1.0.26 → 1.0.28
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/CHANGELOG.md +12 -0
- package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue2.mjs +28 -26
- package/dist/es/components/scale-virtual-list/hooks/useVirtualList.mjs +101 -97
- package/dist/es/node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.4.38/node_modules/@vueuse/shared/index.mjs +1189 -0
- package/dist/lib/node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.4.38/node_modules/@vueuse/shared/index.js +1 -0
- package/dist/lib/packages/antdv/components/scale-virtual-list/component/scale-virtual-list.vue2.js +1 -0
- package/dist/lib/packages/antdv/components/scale-virtual-list/hooks/useVirtualList.js +1 -0
- package/dist/theme-chalk/index.css +1 -1
- package/dist/theme-chalk/scale-virtual-list.css +1 -1
- package/dist/types/components/scale-virtual-list/component/scale-virtual-list.vue.d.ts +8 -2
- package/dist/types/components/scale-virtual-list/hooks/useVirtualList.d.ts +3 -2
- package/dist/types/components/scale-virtual-list/index.d.ts +23 -8
- package/package.json +1 -1
- package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue2.js +0 -1
- package/dist/lib/components/scale-virtual-list/hooks/useVirtualList.js +0 -1
- /package/dist/lib/{components → packages/antdv/components}/base/style/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/hooks/use-collapse-transtion.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/src/collapse-transtion.vue.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/src/collapse-transtion.vue2.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/src/types.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/style/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/form/component/form.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/form/component/form.vue.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/form/component/form.vue2.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/form/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/pro-dialog/hooks/useProDialog.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/pro-dialog/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/pro-dialog/src/pro-dialog.vue.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/pro-dialog/src/pro-dialog.vue2.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/pro-dialog/src/types.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/scale-virtual-list/component/scale-virtual-list.vue.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/scale-virtual-list/component/types.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/scale-virtual-list/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/scale-virtual-list/style/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/scroll-bar/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/scroll-bar/src/scroll-bar.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/scroll-bar/src/types.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/utils/install.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/virtual-list/index.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/virtual-list/src/types.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/virtual-list/src/virtual-list.vue.js +0 -0
- /package/dist/lib/{components → packages/antdv/components}/virtual-list/src/virtual-list.vue2.js +0 -0
- /package/dist/lib/{hooks → packages/antdv/hooks}/use-namespace/index.js +0 -0
- /package/dist/lib/{index.js → packages/antdv/index.js} +0 -0
- /package/dist/lib/{installer.js → packages/antdv/installer.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { defaultNamespace as
|
|
3
|
-
import { useVirtualList as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as g, toRefs as w, openBlock as r, createElementBlock as o, mergeProps as n, unref as e, createElementVNode as i, normalizeClass as B, Fragment as C, renderList as E, renderSlot as L } from "vue";
|
|
2
|
+
import { defaultNamespace as a } from "../../../hooks/use-namespace/index.mjs";
|
|
3
|
+
import { useVirtualList as N } from "../hooks/useVirtualList.mjs";
|
|
4
|
+
const z = /* @__PURE__ */ g({
|
|
5
5
|
__name: "scale-virtual-list",
|
|
6
6
|
props: {
|
|
7
7
|
list: {},
|
|
8
8
|
option: {}
|
|
9
9
|
},
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
emits: ["update:state"],
|
|
11
|
+
setup(p, { expose: c, emit: u }) {
|
|
12
|
+
const l = p, d = u, { list: m } = w(l), { list: f, containerProps: v, wrapperProps: x, scrollTo: _, scaleTo: $, state: k, onUpdate: P } = N(m, l.option);
|
|
12
13
|
return c({
|
|
13
|
-
scrollTo:
|
|
14
|
-
scaleTo:
|
|
15
|
-
|
|
14
|
+
scrollTo: _,
|
|
15
|
+
scaleTo: $,
|
|
16
|
+
state: k
|
|
17
|
+
}), P((t) => d("update:state", t)), (t, T) => (r(), o(
|
|
16
18
|
"div",
|
|
17
|
-
|
|
18
|
-
class: `${e(
|
|
19
|
-
}, e(
|
|
19
|
+
n({
|
|
20
|
+
class: `${e(a)}-scale-virtual-list`
|
|
21
|
+
}, e(v)),
|
|
20
22
|
[
|
|
21
|
-
|
|
23
|
+
i(
|
|
22
24
|
"div",
|
|
23
25
|
{
|
|
24
|
-
class:
|
|
26
|
+
class: B(`${e(a)}-scale-virtual-list-container`)
|
|
25
27
|
},
|
|
26
28
|
[
|
|
27
|
-
|
|
29
|
+
i(
|
|
28
30
|
"div",
|
|
29
|
-
|
|
30
|
-
class: `${e(
|
|
31
|
-
}, e(
|
|
31
|
+
n({
|
|
32
|
+
class: `${e(a)}-scale-vittual-wrapper`
|
|
33
|
+
}, e(x)),
|
|
32
34
|
[
|
|
33
|
-
(
|
|
34
|
-
|
|
35
|
+
(r(!0), o(
|
|
36
|
+
C,
|
|
35
37
|
null,
|
|
36
|
-
|
|
37
|
-
key:
|
|
38
|
+
E(e(f), (s) => (r(), o("div", {
|
|
39
|
+
key: s.index
|
|
38
40
|
}, [
|
|
39
|
-
|
|
40
|
-
item:
|
|
41
|
-
index:
|
|
41
|
+
L(t.$slots, "default", {
|
|
42
|
+
item: s,
|
|
43
|
+
index: s.index
|
|
42
44
|
})
|
|
43
45
|
]))),
|
|
44
46
|
128
|
|
@@ -59,5 +61,5 @@ const T = /* @__PURE__ */ _({
|
|
|
59
61
|
}
|
|
60
62
|
});
|
|
61
63
|
export {
|
|
62
|
-
|
|
64
|
+
z as default
|
|
63
65
|
};
|
|
@@ -1,109 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { createEventHook as $ } from "../../../node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.4.38/node_modules/@vueuse/shared/index.mjs";
|
|
2
|
+
import { ref as z, shallowRef as F, watch as M, computed as y } from "vue-demi";
|
|
3
|
+
import { useElementSize as K } from "@vueuse/core";
|
|
4
|
+
function I(r, t) {
|
|
5
|
+
const { containerStyle: a, wrapperProps: o, scrollTo: c, calculateRange: e, currentList: n, containerRef: l, scaleTo: u, state: s, onUpdate: f } = "itemHeight" in t ? Y(t, r) : X(t, r);
|
|
5
6
|
return {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
onUpdate: f,
|
|
8
|
+
state: s,
|
|
9
|
+
scaleTo: u,
|
|
10
|
+
list: n,
|
|
11
|
+
scrollTo: c,
|
|
10
12
|
containerProps: {
|
|
11
|
-
ref:
|
|
13
|
+
ref: l,
|
|
12
14
|
onScroll: () => {
|
|
13
|
-
|
|
15
|
+
e();
|
|
14
16
|
},
|
|
15
|
-
style:
|
|
17
|
+
style: a
|
|
16
18
|
},
|
|
17
|
-
wrapperProps:
|
|
19
|
+
wrapperProps: o
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
|
-
function
|
|
21
|
-
const t =
|
|
22
|
-
return { state:
|
|
22
|
+
function O(r) {
|
|
23
|
+
const t = z(null), a = K(t), o = z([]), c = F(r);
|
|
24
|
+
return { state: z({ start: 0, end: 10, current: 0, scale: 1 }), source: c, currentList: o, size: a, containerRef: t };
|
|
23
25
|
}
|
|
24
|
-
function
|
|
25
|
-
return (
|
|
26
|
-
const { start:
|
|
27
|
-
if (typeof
|
|
28
|
-
return Math.ceil(
|
|
29
|
-
let
|
|
30
|
-
for (let
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
26
|
+
function P(r, t, a) {
|
|
27
|
+
return (o) => {
|
|
28
|
+
const { start: c = 0, scale: e = 1 } = r.value;
|
|
29
|
+
if (typeof a == "number")
|
|
30
|
+
return Math.ceil(o / (a * e));
|
|
31
|
+
let n = 0, l = 0;
|
|
32
|
+
for (let u = c; u < t.value.length; u++) {
|
|
33
|
+
const s = a(u) * e;
|
|
34
|
+
if (n += s, l = u, n > o)
|
|
33
35
|
break;
|
|
34
36
|
}
|
|
35
|
-
return
|
|
37
|
+
return l - c;
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
|
-
function
|
|
39
|
-
return (
|
|
40
|
-
const { scale:
|
|
40
|
+
function W(r, t, a) {
|
|
41
|
+
return (o) => {
|
|
42
|
+
const { scale: c = 1 } = a.value;
|
|
41
43
|
if (typeof t == "number")
|
|
42
|
-
return Math.floor(
|
|
43
|
-
let
|
|
44
|
-
for (let
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
|
|
44
|
+
return Math.floor(o / (t * c)) + 1;
|
|
45
|
+
let e = 0, n = 0;
|
|
46
|
+
for (let l = 0; l < r.value.length; l++) {
|
|
47
|
+
const u = t(l) * c;
|
|
48
|
+
if (e += u, e >= o) {
|
|
49
|
+
n = l;
|
|
48
50
|
break;
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
|
-
return
|
|
53
|
+
return n + 1;
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
function
|
|
56
|
+
function k(r, t, a, o, { containerRef: c, state: e, currentList: n, source: l }, u) {
|
|
55
57
|
return () => {
|
|
56
|
-
const s =
|
|
58
|
+
const s = c.value;
|
|
57
59
|
if (s) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
start:
|
|
61
|
-
end:
|
|
62
|
-
current:
|
|
63
|
-
scale:
|
|
64
|
-
},
|
|
65
|
-
data:
|
|
66
|
-
index:
|
|
67
|
-
}));
|
|
60
|
+
const f = a(r === "vertical" ? s.scrollTop : s.scrollLeft), i = o(r === "vertical" ? s.clientHeight : s.clientWidth), p = f - t, g = f + i + t;
|
|
61
|
+
e.value = {
|
|
62
|
+
start: p < 0 ? 0 : p,
|
|
63
|
+
end: g > l.value.length ? l.value.length : g,
|
|
64
|
+
current: f - 1,
|
|
65
|
+
scale: e.value.scale
|
|
66
|
+
}, n.value = l.value.slice(e.value.start, e.value.end).map((h, v) => ({
|
|
67
|
+
data: h,
|
|
68
|
+
index: v + e.value.start
|
|
69
|
+
})), u(e.value);
|
|
68
70
|
}
|
|
69
71
|
};
|
|
70
72
|
}
|
|
71
|
-
function
|
|
72
|
-
return (
|
|
73
|
-
const { scale:
|
|
74
|
-
return typeof
|
|
73
|
+
function D(r, t, a) {
|
|
74
|
+
return (o) => {
|
|
75
|
+
const { scale: c = 1 } = a.value;
|
|
76
|
+
return typeof r == "number" ? o * (r * c) : t.value.slice(0, o).reduce((n, l, u) => n + r(u) * c, 0);
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
function E(r, t, a, o) {
|
|
80
|
+
M([r.width, r.height, t, a], () => {
|
|
81
|
+
o();
|
|
80
82
|
});
|
|
81
83
|
}
|
|
82
|
-
function
|
|
84
|
+
function G(r, t, a) {
|
|
83
85
|
return y(() => {
|
|
84
|
-
const { scale:
|
|
85
|
-
return typeof
|
|
86
|
+
const { scale: o = 1 } = a.value;
|
|
87
|
+
return typeof r == "number" ? t.value.length * r * o : t.value.reduce((c, e, n) => c + r(n) * o, 0);
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
|
-
const
|
|
90
|
+
const S = {
|
|
89
91
|
horizontal: "scrollLeft",
|
|
90
92
|
vertical: "scrollTop"
|
|
91
93
|
};
|
|
92
|
-
function
|
|
93
|
-
return (
|
|
94
|
-
|
|
94
|
+
function U(r, t, a, o) {
|
|
95
|
+
return (c) => {
|
|
96
|
+
o.value && (o.value[S[r]] = a(c), t());
|
|
95
97
|
};
|
|
96
98
|
}
|
|
97
|
-
function X(
|
|
98
|
-
const c =
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
e.value.scale =
|
|
102
|
-
},
|
|
99
|
+
function X(r, t) {
|
|
100
|
+
const { on: a, trigger: o } = $(), c = O(t), { state: e, source: n, currentList: l, size: u, containerRef: s } = c, f = { overflowX: "auto" }, { itemWidth: i, overscan: p = 5 } = r, g = P(e, n, i), h = W(n, i, e), v = k("horizontal", p, h, g, c, o), m = D(i, n, e), d = y(() => m(e.value.start)), R = G(i, n, e);
|
|
101
|
+
E(u, t, s, v);
|
|
102
|
+
const V = U("horizontal", v, m, s), b = (T) => {
|
|
103
|
+
e.value.scale = T;
|
|
104
|
+
}, x = y(() => ({
|
|
103
105
|
style: {
|
|
104
106
|
height: "100%",
|
|
105
|
-
width: `${
|
|
106
|
-
marginLeft: `${
|
|
107
|
+
width: `${R.value - d.value}px`,
|
|
108
|
+
marginLeft: `${d.value}px`,
|
|
107
109
|
display: "flex",
|
|
108
110
|
transform: `scale(${e.value.scale})`,
|
|
109
111
|
transformOrigin: "50% 0%"
|
|
@@ -112,45 +114,47 @@ function X(n, t) {
|
|
|
112
114
|
}
|
|
113
115
|
}));
|
|
114
116
|
return {
|
|
117
|
+
onUpdate: a,
|
|
115
118
|
state: e,
|
|
116
|
-
scaleTo:
|
|
117
|
-
scrollTo:
|
|
118
|
-
calculateRange:
|
|
119
|
-
wrapperProps:
|
|
120
|
-
containerStyle:
|
|
121
|
-
currentList:
|
|
122
|
-
containerRef:
|
|
119
|
+
scaleTo: b,
|
|
120
|
+
scrollTo: V,
|
|
121
|
+
calculateRange: v,
|
|
122
|
+
wrapperProps: x,
|
|
123
|
+
containerStyle: f,
|
|
124
|
+
currentList: l,
|
|
125
|
+
containerRef: s
|
|
123
126
|
};
|
|
124
127
|
}
|
|
125
|
-
function
|
|
126
|
-
const c =
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
const { current:
|
|
132
|
-
let
|
|
133
|
-
typeof
|
|
128
|
+
function Y(r, t) {
|
|
129
|
+
const { on: a, trigger: o } = $(), c = O(t), { state: e, source: n, currentList: l, size: u, containerRef: s } = c, f = { overflowY: "auto" }, { itemHeight: i, overscan: p = 5 } = r, g = P(e, n, i), h = W(n, i, e), v = k("vertical", p, h, g, c, o), m = D(i, n, e), d = y(() => m(e.value.start)), R = G(i, n, e);
|
|
130
|
+
E(u, t, s, v);
|
|
131
|
+
const V = U("vertical", v, m, s), b = (T) => {
|
|
132
|
+
const w = s.value;
|
|
133
|
+
if (w) {
|
|
134
|
+
const { current: C } = e.value;
|
|
135
|
+
let L = 0;
|
|
136
|
+
typeof i == "number" ? L = C * (T * i - e.value.scale * i) : L = n.value.slice(0, C).reduce((_, j, H) => _ + T * i(H) - e.value.scale * i(H), 0), w.scrollTop = w.scrollTop + L >= 0 ? w.scrollTop + L : 0, e.value.scale = T;
|
|
134
137
|
}
|
|
135
|
-
},
|
|
138
|
+
}, x = y(() => ({
|
|
136
139
|
style: {
|
|
137
|
-
height: `${
|
|
138
|
-
marginTop: `${
|
|
139
|
-
transform: `
|
|
140
|
+
height: `${R.value - d.value}px`,
|
|
141
|
+
marginTop: `${d.value}px`,
|
|
142
|
+
transform: `scale(${e.value.scale})`,
|
|
140
143
|
transformOrigin: "50% 0%"
|
|
141
144
|
}
|
|
142
145
|
}));
|
|
143
146
|
return {
|
|
147
|
+
onUpdate: a,
|
|
144
148
|
state: e,
|
|
145
|
-
scaleTo:
|
|
146
|
-
calculateRange:
|
|
147
|
-
scrollTo:
|
|
148
|
-
containerStyle:
|
|
149
|
-
wrapperProps:
|
|
150
|
-
currentList:
|
|
151
|
-
containerRef:
|
|
149
|
+
scaleTo: b,
|
|
150
|
+
calculateRange: v,
|
|
151
|
+
scrollTo: V,
|
|
152
|
+
containerStyle: f,
|
|
153
|
+
wrapperProps: x,
|
|
154
|
+
currentList: l,
|
|
155
|
+
containerRef: s
|
|
152
156
|
};
|
|
153
157
|
}
|
|
154
158
|
export {
|
|
155
|
-
|
|
159
|
+
I as useVirtualList
|
|
156
160
|
};
|