@king-one/antdv 1.0.75 → 1.0.76
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 +6 -0
- package/dist/es/components/collapse-transtion/src/collapse-transtion.vue2.mjs +2 -2
- package/dist/es/components/form/component/form-item.vue2.mjs +2 -2
- package/dist/es/components/form/component/form.vue2.mjs +2 -2
- package/dist/es/components/icon/src/icon.vue2.mjs +4 -4
- package/dist/es/components/pro-area/src/ProArea.vue2.mjs +8 -8
- package/dist/es/components/pro-modal/src/ProModal.vue2.mjs +13 -13
- package/dist/es/components/pro-picker/src/ProPicker.vue2.mjs +3 -3
- package/dist/es/components/pro-signature/src/ProSignature.vue2.mjs +4 -4
- package/dist/es/components/pro-tag/src/ProTag.vue2.mjs +7 -7
- package/dist/es/components/pro-title/src/ProTitle.vue2.mjs +7 -7
- package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue2.mjs +4 -4
- package/dist/es/components/scale-virtual-list/hooks/useVirtualList.mjs +44 -43
- package/dist/es/components/scroll-bar/src/scroll-bar.mjs +6 -6
- package/dist/lib/components/scale-virtual-list/hooks/useVirtualList.js +1 -1
- package/dist/lib/components/scroll-bar/src/scroll-bar.js +1 -1
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/types/components/collapse-transtion/index.d.ts +5 -10
- package/dist/types/components/collapse-transtion/src/collapse-transtion.vue.d.ts +6 -5
- package/dist/types/components/form/component/form-item.vue.d.ts +6 -5
- package/dist/types/components/form/component/form.vue.d.ts +4 -3
- package/dist/types/components/form/index.d.ts +8 -14
- package/dist/types/components/icon/index.d.ts +5 -5
- package/dist/types/components/icon/src/icon.vue.d.ts +5 -5
- package/dist/types/components/pro-area/hooks/use-pro-area.d.ts +1 -1
- package/dist/types/components/pro-area/index.d.ts +9 -9
- package/dist/types/components/pro-area/src/ProArea.vue.d.ts +9 -9
- package/dist/types/components/pro-modal/hooks/useProModal.d.ts +1 -1
- package/dist/types/components/pro-modal/index.d.ts +17 -33
- package/dist/types/components/pro-modal/src/Modal.d.ts +5 -5
- package/dist/types/components/pro-modal/src/ProModal.vue.d.ts +11 -8
- package/dist/types/components/pro-picker/index.d.ts +9 -8
- package/dist/types/components/pro-picker/src/ProPicker.vue.d.ts +9 -8
- package/dist/types/components/pro-signature/index.d.ts +9 -7
- package/dist/types/components/pro-signature/src/ProSignature.vue.d.ts +9 -7
- package/dist/types/components/pro-tag/index.d.ts +7 -7
- package/dist/types/components/pro-tag/src/ProTag.vue.d.ts +7 -7
- package/dist/types/components/pro-title/index.d.ts +7 -24
- package/dist/types/components/pro-title/src/ProTitle.vue.d.ts +7 -6
- package/dist/types/components/scale-virtual-list/component/scale-virtual-list.vue.d.ts +12 -30
- package/dist/types/components/scale-virtual-list/index.d.ts +21 -73
- package/dist/types/components/scroll-bar/index.d.ts +12 -12
- package/dist/types/components/scroll-bar/src/scroll-bar.d.ts +12 -12
- package/dist/types/hooks/useProForm.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as a,
|
|
1
|
+
import { defineComponent as a, createBlock as s, openBlock as p, Transition as i, mergeProps as l, unref as o, toHandlers as m, withCtx as c, renderSlot as f } from "vue";
|
|
2
2
|
import { defaultNamespace as r } from "../../../hooks/use-namespace/index.mjs";
|
|
3
3
|
import { useCollapseTranstion as u } from "../hooks/use-collapse-transtion.mjs";
|
|
4
4
|
import { collapseProps as d } from "./types.mjs";
|
|
@@ -8,7 +8,7 @@ const z = /* @__PURE__ */ a({
|
|
|
8
8
|
props: d,
|
|
9
9
|
setup(t) {
|
|
10
10
|
const n = u(t);
|
|
11
|
-
return (e, h) => (
|
|
11
|
+
return (e, h) => (p(), s(i, l({
|
|
12
12
|
name: e.mode === "horizontal" ? `${o(r)}-horizontal-transition` : `${o(r)}-vertical-transition`
|
|
13
13
|
}, m(o(n))), {
|
|
14
14
|
default: c(() => [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as p, computed as f, ref as d, toRaw as u,
|
|
1
|
+
import { defineComponent as p, computed as f, ref as d, toRaw as u, createElementBlock as v, openBlock as g, normalizeClass as e, createElementVNode as r, unref as s, renderSlot as _, toDisplayString as b } from "vue";
|
|
2
2
|
import { useNamespace as I } from "../../../hooks/use-namespace/index.mjs";
|
|
3
3
|
import { useProvideFormItem as k } from "../content/form-content.mjs";
|
|
4
4
|
import { formItemProps as y } from "./form.mjs";
|
|
@@ -10,7 +10,7 @@ const P = /* @__PURE__ */ p({
|
|
|
10
10
|
const l = a, { b: m, e: o } = I("form-item"), n = f(() => [m()]), c = async (t) => {
|
|
11
11
|
console.log("trigger", t);
|
|
12
12
|
}, i = d("请输入姓名");
|
|
13
|
-
return k({ ...u(l), validate: c }), (t, B) => (
|
|
13
|
+
return k({ ...u(l), validate: c }), (t, B) => (g(), v(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
class: e(n.value)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as t, computed as m,
|
|
1
|
+
import { defineComponent as t, computed as m, createElementBlock as n, openBlock as s, normalizeClass as a, renderSlot as c } from "vue";
|
|
2
2
|
import { useNamespace as l } from "../../../hooks/use-namespace/index.mjs";
|
|
3
3
|
const d = /* @__PURE__ */ t({
|
|
4
4
|
name: "KForm",
|
|
5
5
|
__name: "form",
|
|
6
6
|
setup(p) {
|
|
7
7
|
const { b: e } = l("form"), o = m(() => [e()]);
|
|
8
|
-
return (r, f) => (
|
|
8
|
+
return (r, f) => (s(), n(
|
|
9
9
|
"form",
|
|
10
10
|
{
|
|
11
11
|
class: a(o.value)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as l, computed as e,
|
|
1
|
+
import { defineComponent as l, computed as e, createElementBlock as a, openBlock as m, normalizeStyle as i, normalizeClass as p } from "vue";
|
|
2
2
|
import { useNamespace as u } from "../../../hooks/use-namespace/index.mjs";
|
|
3
3
|
import { iconProps as f } from "./types.mjs";
|
|
4
4
|
const x = /* @__PURE__ */ l({
|
|
@@ -9,11 +9,11 @@ const x = /* @__PURE__ */ l({
|
|
|
9
9
|
fontSize: `${o.size}px`,
|
|
10
10
|
color: o.color
|
|
11
11
|
})), s = e(() => [c(), t.value]);
|
|
12
|
-
return (_, z) => (
|
|
12
|
+
return (_, z) => (m(), a(
|
|
13
13
|
"i",
|
|
14
14
|
{
|
|
15
|
-
class:
|
|
16
|
-
style:
|
|
15
|
+
class: p(s.value),
|
|
16
|
+
style: i(r.value)
|
|
17
17
|
},
|
|
18
18
|
null,
|
|
19
19
|
6
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as B,
|
|
1
|
+
import { defineComponent as B, useModel as F, computed as u, createBlock as m, openBlock as i, unref as d, withCtx as f, createElementBlock as P, Fragment as w, renderList as y, createVNode as A, normalizeClass as E, mergeModels as I } from "vue";
|
|
2
2
|
import { Form as M, Row as N, Col as k, Select as U } from "ant-design-vue";
|
|
3
3
|
import { useNamespace as j } from "../../../hooks/use-namespace/index.mjs";
|
|
4
4
|
import { ProAreaProps as q } from "./types.mjs";
|
|
5
5
|
const R = /* @__PURE__ */ B({
|
|
6
6
|
name: "ProArea",
|
|
7
7
|
__name: "ProArea",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ I(q, {
|
|
9
9
|
modelValue: {
|
|
10
10
|
required: !0
|
|
11
11
|
},
|
|
@@ -15,7 +15,7 @@ const R = /* @__PURE__ */ B({
|
|
|
15
15
|
setup(p) {
|
|
16
16
|
const n = p;
|
|
17
17
|
M.useInjectFormItemContext();
|
|
18
|
-
const a =
|
|
18
|
+
const a = F(p, "modelValue"), { b: v } = j("pro-area-select"), h = u(() => (e) => `请选择${e === 1 ? "请选择省份" : e === 2 ? "请选择城市" : "请选择区县"}`), g = u(() => (e) => n.options.length > 0 ? C(e) : []);
|
|
19
19
|
function C(e) {
|
|
20
20
|
var t;
|
|
21
21
|
if (e === 1)
|
|
@@ -67,19 +67,19 @@ const R = /* @__PURE__ */ B({
|
|
|
67
67
|
}
|
|
68
68
|
return (e, t) => (i(), m(d(N), { gutter: 10 }, {
|
|
69
69
|
default: f(() => [
|
|
70
|
-
(i(!0),
|
|
71
|
-
|
|
70
|
+
(i(!0), P(
|
|
71
|
+
w,
|
|
72
72
|
null,
|
|
73
|
-
|
|
73
|
+
y(c.value, (l, o) => (i(), m(d(k), {
|
|
74
74
|
key: l,
|
|
75
75
|
span: 24 / e.level
|
|
76
76
|
}, {
|
|
77
77
|
default: f(() => [
|
|
78
|
-
|
|
78
|
+
A(d(U), {
|
|
79
79
|
value: a.value[l],
|
|
80
80
|
"onUpdate:value": (b) => a.value[l] = b,
|
|
81
81
|
placeholder: h.value(o + 1),
|
|
82
|
-
class:
|
|
82
|
+
class: E(V.value),
|
|
83
83
|
options: g.value(o + 1),
|
|
84
84
|
onChange: () => _(o + 1)
|
|
85
85
|
}, null, 8, ["value", "onUpdate:value", "placeholder", "class", "options", "onChange"])
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as X,
|
|
1
|
+
import { defineComponent as X, ref as e, useModel as Y, computed as y, watch as M, watchEffect as E, createBlock as R, openBlock as b, unref as N, mergeProps as q, createSlots as z, withCtx as r, renderSlot as w, createElementVNode as k, normalizeStyle as O, resolveDynamicComponent as U, toDisplayString as _, mergeModels as P } from "vue";
|
|
2
2
|
import { Modal as j } from "ant-design-vue";
|
|
3
3
|
import { useNamespace as A } from "../../../hooks/use-namespace/index.mjs";
|
|
4
4
|
import { useDraggable as F } from "@vueuse/core";
|
|
@@ -6,13 +6,13 @@ import { ProModalProps as G } from "./types.mjs";
|
|
|
6
6
|
const Q = /* @__PURE__ */ X({
|
|
7
7
|
name: "ProModal",
|
|
8
8
|
__name: "ProModal",
|
|
9
|
-
props: /* @__PURE__ */
|
|
9
|
+
props: /* @__PURE__ */ P(G, {
|
|
10
10
|
modelValue: { required: !0, type: Boolean },
|
|
11
11
|
modelModifiers: {}
|
|
12
12
|
}),
|
|
13
|
-
emits: /* @__PURE__ */
|
|
13
|
+
emits: /* @__PURE__ */ P(["onConfirm", "onCancel"], ["update:modelValue"]),
|
|
14
14
|
setup(B, { emit: D }) {
|
|
15
|
-
const c = D, l = e(null), f = Y(B, "modelValue"), { b: S } = A("pro-modal"), $ =
|
|
15
|
+
const c = D, l = e(null), f = Y(B, "modelValue"), { b: S } = A("pro-modal"), $ = y(() => S());
|
|
16
16
|
function T() {
|
|
17
17
|
c("onConfirm");
|
|
18
18
|
}
|
|
@@ -20,22 +20,22 @@ const Q = /* @__PURE__ */ X({
|
|
|
20
20
|
c("onCancel");
|
|
21
21
|
}
|
|
22
22
|
const { x: s, y: u, isDragging: v } = F(l), p = e(0), g = e(0), n = e(!1), m = e(0), i = e(0), h = e(0), C = e(0), o = e({ left: 0, right: 0, top: 0, bottom: 0 });
|
|
23
|
-
|
|
23
|
+
M([s, u], () => {
|
|
24
24
|
if (!n.value && l.value) {
|
|
25
25
|
p.value = s.value, g.value = u.value;
|
|
26
26
|
const t = document.body.getBoundingClientRect(), a = l.value.getBoundingClientRect();
|
|
27
27
|
o.value.right = t.width - a.width, o.value.bottom = t.height - a.height, h.value = m.value, C.value = i.value;
|
|
28
28
|
}
|
|
29
29
|
n.value = !0;
|
|
30
|
-
}),
|
|
30
|
+
}), M(v, () => {
|
|
31
31
|
v || (n.value = !1);
|
|
32
32
|
}), E(() => {
|
|
33
33
|
n.value && (m.value = h.value + Math.min(Math.max(o.value.left, s.value), o.value.right) - p.value, i.value = C.value + Math.min(Math.max(o.value.top, u.value), o.value.bottom) - g.value);
|
|
34
34
|
});
|
|
35
|
-
const x =
|
|
35
|
+
const x = y(() => ({
|
|
36
36
|
transform: `translate(${m.value}px, ${i.value}px)`
|
|
37
37
|
}));
|
|
38
|
-
return (t, a) => (b(),
|
|
38
|
+
return (t, a) => (b(), R(N(j), q({
|
|
39
39
|
open: f.value,
|
|
40
40
|
"onUpdate:open": a[0] || (a[0] = (d) => f.value = d)
|
|
41
41
|
}, t.modalProps, {
|
|
@@ -51,7 +51,7 @@ const Q = /* @__PURE__ */ X({
|
|
|
51
51
|
ref: l,
|
|
52
52
|
class: "pro-modal-title"
|
|
53
53
|
},
|
|
54
|
-
|
|
54
|
+
_(t.title),
|
|
55
55
|
513
|
|
56
56
|
/* TEXT, NEED_PATCH */
|
|
57
57
|
)
|
|
@@ -60,17 +60,17 @@ const Q = /* @__PURE__ */ X({
|
|
|
60
60
|
k(
|
|
61
61
|
"div",
|
|
62
62
|
{
|
|
63
|
-
style:
|
|
63
|
+
style: O(x.value)
|
|
64
64
|
},
|
|
65
65
|
[
|
|
66
|
-
(b(),
|
|
66
|
+
(b(), R(U(d)))
|
|
67
67
|
],
|
|
68
68
|
4
|
|
69
69
|
/* STYLE */
|
|
70
70
|
)
|
|
71
71
|
]),
|
|
72
72
|
default: r(() => [
|
|
73
|
-
|
|
73
|
+
w(t.$slots, "default")
|
|
74
74
|
]),
|
|
75
75
|
_: 2
|
|
76
76
|
/* DYNAMIC */
|
|
@@ -78,7 +78,7 @@ const Q = /* @__PURE__ */ X({
|
|
|
78
78
|
t.$slots.footer ? {
|
|
79
79
|
name: "footer",
|
|
80
80
|
fn: r(() => [
|
|
81
|
-
|
|
81
|
+
w(t.$slots, "footer")
|
|
82
82
|
]),
|
|
83
83
|
key: "0"
|
|
84
84
|
} : void 0
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as g,
|
|
1
|
+
import { defineComponent as g, useModel as y, reactive as b, watch as P, createBlock as k, openBlock as S, unref as s, createSlots as C, withCtx as w, createVNode as A, mergeModels as d } from "vue";
|
|
2
2
|
import { debounce as M } from "lodash-es";
|
|
3
3
|
import { Select as O, Spin as B } from "ant-design-vue";
|
|
4
4
|
import { proPickerApi as p } from "../apis/pro-picker.api.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { PickerApiEnum as u, ProPickerProps as _ } from "./types.mjs";
|
|
6
6
|
const N = /* @__PURE__ */ g({
|
|
7
7
|
name: "ProPicker",
|
|
8
8
|
__name: "ProPicker",
|
|
@@ -59,7 +59,7 @@ const N = /* @__PURE__ */ g({
|
|
|
59
59
|
function v(e, o) {
|
|
60
60
|
m("change", o);
|
|
61
61
|
}
|
|
62
|
-
return (e, o) => (
|
|
62
|
+
return (e, o) => (S(), k(s(O), {
|
|
63
63
|
value: i.value,
|
|
64
64
|
"onUpdate:value": o[0] || (o[0] = (n) => i.value = n),
|
|
65
65
|
mode: e.mode,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as A, ref as o, computed as k, watch as F, onMounted as N, onBeforeUnmount as $, reactive as H,
|
|
1
|
+
import { defineComponent as A, ref as o, computed as k, watch as F, onMounted as N, onBeforeUnmount as $, reactive as H, createElementBlock as Q, openBlock as G, withModifiers as K, normalizeStyle as V } from "vue";
|
|
2
2
|
import { ProSignatureProps as Z } from "./types.mjs";
|
|
3
3
|
const te = /* @__PURE__ */ A({
|
|
4
4
|
__name: "ProSignature",
|
|
@@ -121,18 +121,18 @@ const te = /* @__PURE__ */ A({
|
|
|
121
121
|
return X({
|
|
122
122
|
generate: U,
|
|
123
123
|
reset: J
|
|
124
|
-
}), (e, l) => (
|
|
124
|
+
}), (e, l) => (G(), Q(
|
|
125
125
|
"canvas",
|
|
126
126
|
{
|
|
127
127
|
ref_key: "canvas",
|
|
128
128
|
ref: a,
|
|
129
|
-
style:
|
|
129
|
+
style: V(O),
|
|
130
130
|
onMousedown: B,
|
|
131
131
|
onMousemove: I,
|
|
132
132
|
onMouseup: E,
|
|
133
133
|
onTouchstartPassive: _,
|
|
134
134
|
onTouchmovePassive: L,
|
|
135
|
-
onTouchend:
|
|
135
|
+
onTouchend: K(W, ["prevent"])
|
|
136
136
|
},
|
|
137
137
|
null,
|
|
138
138
|
36
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { defineComponent as c,
|
|
1
|
+
import { defineComponent as c, useModel as p, computed as s, createBlock as i, openBlock as d, unref as m, withCtx as g, createTextVNode as f, toDisplayString as T, mergeModels as _ } from "vue";
|
|
2
2
|
import { Tag as v } from "ant-design-vue";
|
|
3
3
|
import { proTagProps as x } from "./types.mjs";
|
|
4
4
|
const S = /* @__PURE__ */ c({
|
|
5
5
|
name: "ProTag",
|
|
6
6
|
__name: "ProTag",
|
|
7
|
-
props: /* @__PURE__ */
|
|
7
|
+
props: /* @__PURE__ */ _(x, {
|
|
8
8
|
tag: { type: [String, Number, Boolean], required: !0 },
|
|
9
9
|
tagModifiers: {}
|
|
10
10
|
}),
|
|
11
11
|
emits: ["update:tag"],
|
|
12
12
|
setup(e) {
|
|
13
|
-
const n = e, l =
|
|
13
|
+
const n = e, l = p(e, "tag"), t = s(() => n.options.find((o) => o.value === l.value));
|
|
14
14
|
return (u, o) => {
|
|
15
15
|
var a;
|
|
16
|
-
return d(), m(
|
|
16
|
+
return d(), i(m(v), {
|
|
17
17
|
color: ((a = t.value) == null ? void 0 : a.color) || "default"
|
|
18
18
|
}, {
|
|
19
|
-
default:
|
|
19
|
+
default: g(() => {
|
|
20
20
|
var r;
|
|
21
21
|
return [
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
f(
|
|
23
|
+
T(((r = t.value) == null ? void 0 : r.label) || ""),
|
|
24
24
|
1
|
|
25
25
|
/* TEXT */
|
|
26
26
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as s, computed as i,
|
|
1
|
+
import { defineComponent as s, computed as i, createElementBlock as a, openBlock as c, normalizeClass as m, createVNode as p, createElementVNode as u, renderSlot as f, unref as d, normalizeStyle as z, toDisplayString as S } from "vue";
|
|
2
2
|
import { useNamespace as y } from "../../../hooks/use-namespace/index.mjs";
|
|
3
3
|
import { KIcon as B } from "../../icon/index.mjs";
|
|
4
4
|
import { TitleProps as N } from "./types.mjs";
|
|
@@ -8,28 +8,28 @@ const C = /* @__PURE__ */ s({
|
|
|
8
8
|
props: N,
|
|
9
9
|
setup(r) {
|
|
10
10
|
const t = r, { b: o, m: n } = y("pro-title"), l = i(() => t.unBorder ? [o(), n("unborder")] : [o()]);
|
|
11
|
-
return (e, P) => (
|
|
11
|
+
return (e, P) => (c(), a(
|
|
12
12
|
"div",
|
|
13
13
|
{
|
|
14
14
|
class: m(l.value)
|
|
15
15
|
},
|
|
16
16
|
[
|
|
17
|
-
p(
|
|
17
|
+
p(d(B), {
|
|
18
18
|
name: "title-icon",
|
|
19
19
|
class: "icon",
|
|
20
20
|
size: e.size,
|
|
21
21
|
color: e.color
|
|
22
22
|
}, null, 8, ["size", "color"]),
|
|
23
|
-
|
|
23
|
+
u(
|
|
24
24
|
"span",
|
|
25
25
|
{
|
|
26
|
-
style:
|
|
26
|
+
style: z({ fontSize: `${e.size}px`, color: e.color })
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
S(e.title),
|
|
29
29
|
5
|
|
30
30
|
/* TEXT, STYLE */
|
|
31
31
|
),
|
|
32
|
-
|
|
32
|
+
f(e.$slots, "default")
|
|
33
33
|
],
|
|
34
34
|
2
|
|
35
35
|
/* CLASS */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as h, ref as B, computed as E, toRefs as P,
|
|
1
|
+
import { defineComponent as h, ref as B, computed as E, toRefs as P, createElementBlock as a, openBlock as l, mergeProps as i, unref as e, createElementVNode as p, normalizeStyle as R, normalizeClass as c, Fragment as S, renderList as z, renderSlot as L } from "vue";
|
|
2
2
|
import { defaultNamespace as s } from "../../../hooks/use-namespace/index.mjs";
|
|
3
3
|
import { useElementBounding as T } from "@vueuse/core";
|
|
4
4
|
import { useVirtualList as V } from "../hooks/useVirtualList.mjs";
|
|
@@ -18,7 +18,7 @@ const q = /* @__PURE__ */ h({
|
|
|
18
18
|
scrollTo: k,
|
|
19
19
|
scaleTo: C,
|
|
20
20
|
state: N
|
|
21
|
-
}), g((t) => f("update:state", t)), (t, F) => (
|
|
21
|
+
}), g((t) => f("update:state", t)), (t, F) => (l(), a(
|
|
22
22
|
"div",
|
|
23
23
|
i({
|
|
24
24
|
class: `${e(s)}-scale-virtual-list`
|
|
@@ -39,10 +39,10 @@ const q = /* @__PURE__ */ h({
|
|
|
39
39
|
class: `${e(s)}-scale-vittual-wrapper`
|
|
40
40
|
}),
|
|
41
41
|
[
|
|
42
|
-
(
|
|
42
|
+
(l(!0), a(
|
|
43
43
|
S,
|
|
44
44
|
null,
|
|
45
|
-
z(e(x), (r) => (
|
|
45
|
+
z(e(x), (r) => (l(), a(
|
|
46
46
|
"div",
|
|
47
47
|
{
|
|
48
48
|
key: r.index,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createEventHook as
|
|
1
|
+
import { createEventHook as x } from "@vueuse/shared";
|
|
2
2
|
import { ref as H, shallowRef as _, watch as F, computed as y } from "vue";
|
|
3
3
|
import { useElementSize as X } from "@vueuse/core";
|
|
4
4
|
function I(r, t) {
|
|
5
|
-
const { containerStyle: a, wrapperProps:
|
|
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) : S(t, r);
|
|
6
6
|
return {
|
|
7
7
|
onUpdate: f,
|
|
8
8
|
state: s,
|
|
9
9
|
scaleTo: u,
|
|
10
|
-
list:
|
|
10
|
+
list: n,
|
|
11
11
|
scrollTo: c,
|
|
12
12
|
containerProps: {
|
|
13
13
|
ref: l,
|
|
@@ -16,54 +16,54 @@ function I(r, t) {
|
|
|
16
16
|
},
|
|
17
17
|
style: a
|
|
18
18
|
},
|
|
19
|
-
wrapperProps:
|
|
19
|
+
wrapperProps: o
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const t = H(null), a = X(t),
|
|
24
|
-
return { state: H({ start: 0, end: 10, current: 0, scale: 1 }), source: c, currentList:
|
|
22
|
+
function O(r) {
|
|
23
|
+
const t = H(null), a = X(t), o = H([]), c = _(r);
|
|
24
|
+
return { state: H({ start: 0, end: 10, current: 0, scale: 1 }), source: c, currentList: o, size: a, containerRef: t };
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
return (
|
|
26
|
+
function z(r, t, a) {
|
|
27
|
+
return (o) => {
|
|
28
28
|
const { start: c = 0, scale: e = 1 } = r.value;
|
|
29
29
|
if (typeof a == "number")
|
|
30
|
-
return Math.ceil(
|
|
31
|
-
let
|
|
30
|
+
return Math.ceil(o / (a * e));
|
|
31
|
+
let n = 0, l = 0;
|
|
32
32
|
for (let u = c; u < t.value.length; u++) {
|
|
33
33
|
const s = a(u) * e;
|
|
34
|
-
if (
|
|
34
|
+
if (n += s, l = u, n > o)
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
return l - c;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
function P(r, t, a) {
|
|
41
|
-
return (
|
|
41
|
+
return (o) => {
|
|
42
42
|
const { scale: c = 1 } = a.value;
|
|
43
43
|
if (typeof t == "number")
|
|
44
|
-
return Math.floor(
|
|
45
|
-
let e = 0,
|
|
44
|
+
return Math.floor(o / (t * c)) + 1;
|
|
45
|
+
let e = 0, n = 0;
|
|
46
46
|
for (let l = 0; l < r.value.length; l++) {
|
|
47
47
|
const u = t(l) * c;
|
|
48
|
-
if (e += u, e >
|
|
49
|
-
|
|
48
|
+
if (e += u, e > o) {
|
|
49
|
+
n = l;
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
return
|
|
53
|
+
return n + 1;
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function W(r, t, a,
|
|
56
|
+
function W(r, t, a, o, { containerRef: c, state: e, currentList: n, source: l }, u) {
|
|
57
57
|
return () => {
|
|
58
58
|
const s = c.value;
|
|
59
59
|
if (s) {
|
|
60
|
-
const f = a(r === "vertical" ? s.scrollTop : s.scrollLeft), i =
|
|
60
|
+
const f = a(Math.ceil(r === "vertical" ? s.scrollTop : s.scrollLeft)), i = o(r === "vertical" ? s.clientHeight : s.clientWidth), p = f - t, g = f + i + t;
|
|
61
61
|
e.value = {
|
|
62
62
|
start: p < 0 ? 0 : p,
|
|
63
63
|
end: g > l.value.length ? l.value.length : g,
|
|
64
64
|
current: f - 1,
|
|
65
65
|
scale: e.value.scale
|
|
66
|
-
},
|
|
66
|
+
}, n.value = l.value.slice(e.value.start, e.value.end).map((h, v) => ({
|
|
67
67
|
data: h,
|
|
68
68
|
index: v + e.value.start
|
|
69
69
|
})), u(e.value);
|
|
@@ -71,50 +71,51 @@ function W(r, t, a, n, { containerRef: c, state: e, currentList: o, source: l },
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
function k(r, t, a) {
|
|
74
|
-
return (
|
|
74
|
+
return (o) => {
|
|
75
75
|
const { scale: c = 1 } = a.value;
|
|
76
76
|
if (typeof r == "number") {
|
|
77
|
-
const
|
|
78
|
-
return Math.ceil(
|
|
77
|
+
const n = o * (r * c);
|
|
78
|
+
return Math.ceil(n);
|
|
79
79
|
}
|
|
80
|
-
const e = t.value.slice(0,
|
|
80
|
+
const e = t.value.slice(0, o).reduce((n, l, u) => n + r(u) * c, 0);
|
|
81
81
|
return Math.ceil(e);
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
function D(r, t, a,
|
|
84
|
+
function D(r, t, a, o) {
|
|
85
85
|
F([r.width, r.height, t, a], () => {
|
|
86
|
-
|
|
86
|
+
o();
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
function E(r, t, a) {
|
|
90
90
|
return y(() => {
|
|
91
|
-
const { scale:
|
|
92
|
-
return typeof r == "number" ? t.value.length * r *
|
|
91
|
+
const { scale: o = 1 } = a.value;
|
|
92
|
+
return typeof r == "number" ? t.value.length * r * o : t.value.reduce((c, e, n) => c + r(n) * o, 0);
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
const K = {
|
|
96
96
|
horizontal: "scrollLeft",
|
|
97
97
|
vertical: "scrollTop"
|
|
98
98
|
};
|
|
99
|
-
function G(r, t, a,
|
|
99
|
+
function G(r, t, a, o) {
|
|
100
100
|
return (c) => {
|
|
101
|
-
if (
|
|
101
|
+
if (o.value) {
|
|
102
102
|
if (c < 0)
|
|
103
103
|
return;
|
|
104
|
-
|
|
104
|
+
const e = a(c);
|
|
105
|
+
o.value[K[r]] = e, t();
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
}
|
|
108
109
|
function S(r, t) {
|
|
109
|
-
const { on: a, trigger:
|
|
110
|
+
const { on: a, trigger: o } = x(), c = O(t), { state: e, source: n, currentList: l, size: u, containerRef: s } = c, f = { overflowX: "auto" }, { itemWidth: i, overscan: p = 5 } = r, g = z(e, n, i), h = P(n, i, e), v = W("horizontal", p, h, g, c, o), m = k(i, n, e), T = y(() => m(e.value.start)), R = E(i, n, e);
|
|
110
111
|
D(u, t, s, v);
|
|
111
|
-
const V = G("horizontal", v, m, s), b = (
|
|
112
|
-
e.value.scale =
|
|
112
|
+
const V = G("horizontal", v, m, s), b = (d) => {
|
|
113
|
+
e.value.scale = d;
|
|
113
114
|
}, C = y(() => ({
|
|
114
115
|
style: {
|
|
115
116
|
height: "100%",
|
|
116
|
-
width: `${R.value -
|
|
117
|
-
marginLeft: `${
|
|
117
|
+
width: `${R.value - T.value}px`,
|
|
118
|
+
marginLeft: `${T.value}px`,
|
|
118
119
|
display: "flex",
|
|
119
120
|
transform: `scale(${e.value.scale})`,
|
|
120
121
|
transformOrigin: "0% 0%"
|
|
@@ -135,19 +136,19 @@ function S(r, t) {
|
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
function Y(r, t) {
|
|
138
|
-
const { on: a, trigger:
|
|
139
|
+
const { on: a, trigger: o } = x(), c = O(t), { state: e, source: n, currentList: l, size: u, containerRef: s } = c, f = { overflowY: "auto" }, { itemHeight: i, overscan: p = 5 } = r, g = z(e, n, i), h = P(n, i, e), v = W("vertical", p, h, g, c, o), m = k(i, n, e), T = y(() => m(e.value.start)), R = E(i, n, e);
|
|
139
140
|
D(u, t, s, v);
|
|
140
|
-
const V = G("vertical", v, m, s), b = (
|
|
141
|
+
const V = G("vertical", v, m, s), b = (d) => {
|
|
141
142
|
const w = s.value;
|
|
142
143
|
if (w) {
|
|
143
|
-
const { current:
|
|
144
|
+
const { current: M } = e.value;
|
|
144
145
|
let L = 0;
|
|
145
|
-
typeof i == "number" ? L =
|
|
146
|
+
typeof i == "number" ? L = M * (d * i - e.value.scale * i) : L = n.value.slice(0, M).reduce((U, j, $) => U + d * i($) - e.value.scale * i($), 0), w.scrollTop = w.scrollTop + L >= 0 ? w.scrollTop + L : 0, e.value.scale = d;
|
|
146
147
|
}
|
|
147
148
|
}, C = y(() => ({
|
|
148
149
|
style: {
|
|
149
|
-
height: `${R.value -
|
|
150
|
-
marginTop: `${
|
|
150
|
+
height: `${R.value - T.value}px`,
|
|
151
|
+
marginTop: `${T.value}px`,
|
|
151
152
|
transform: `translateX(-50%) scale(${e.value.scale})`,
|
|
152
153
|
transformOrigin: "50% 0%"
|
|
153
154
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as ue,
|
|
1
|
+
import { defineComponent as ue, createVNode as h, mergeProps as se, onMounted as fe, ref as l, computed as r } from "vue";
|
|
2
2
|
import { useResizeObserver as k } from "@vueuse/core";
|
|
3
3
|
import { off as T, on as X } from "evtd";
|
|
4
4
|
import { defaultNamespace as s } from "../../../hooks/use-namespace/index.mjs";
|
|
@@ -8,7 +8,7 @@ const Me = /* @__PURE__ */ ue({
|
|
|
8
8
|
props: de,
|
|
9
9
|
inheritAttrs: !1,
|
|
10
10
|
setup(o) {
|
|
11
|
-
|
|
11
|
+
fe(() => {
|
|
12
12
|
o.container || v();
|
|
13
13
|
});
|
|
14
14
|
const R = l(null), m = l(null), x = l(null), Y = l(null), d = l(null), f = l(null), u = l(null), S = l(null), b = l(null), L = l(null), q = r(() => {
|
|
@@ -230,7 +230,7 @@ const Me = /* @__PURE__ */ ue({
|
|
|
230
230
|
left: this.xBarLeftPxRef
|
|
231
231
|
},
|
|
232
232
|
onMousedown: this.handleXScrollMouseDown
|
|
233
|
-
}, null,
|
|
233
|
+
}, null, 46, ["onMousedown"])], 2), x = () => h("div", {
|
|
234
234
|
class: `${s}-scrollbar-rail ${s}-scrollbar-rail--vertical`,
|
|
235
235
|
ref: "yRailRef"
|
|
236
236
|
}, [this.needYBarRef && this.showYBarRef && h("div", {
|
|
@@ -240,10 +240,10 @@ const Me = /* @__PURE__ */ ue({
|
|
|
240
240
|
top: this.yBarTopPxRef
|
|
241
241
|
},
|
|
242
242
|
onMousedown: this.handleYScrollMouseDown
|
|
243
|
-
}, null,
|
|
243
|
+
}, null, 46, ["onMousedown"])], 2);
|
|
244
244
|
return (() => {
|
|
245
245
|
var f, u;
|
|
246
|
-
return h("div",
|
|
246
|
+
return h("div", se({
|
|
247
247
|
class: `${s}-scrollbar`
|
|
248
248
|
}, this.$attrs, {
|
|
249
249
|
onMouseenter: this.handleMouseEnter,
|
|
@@ -255,7 +255,7 @@ const Me = /* @__PURE__ */ ue({
|
|
|
255
255
|
}, [h("div", {
|
|
256
256
|
ref: "contentRef",
|
|
257
257
|
class: `${s}-scrollbar-content`
|
|
258
|
-
}, [(u = o.default) == null ? void 0 : u.call(o)],
|
|
258
|
+
}, [(u = o.default) == null ? void 0 : u.call(o)], 2)], 42, ["onScroll"]), x(), R && m()], 16, ["onMouseenter", "onMouseleave"]);
|
|
259
259
|
})();
|
|
260
260
|
}
|
|
261
261
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("@vueuse/shared"),f=require("vue"),G=require("@vueuse/core");function S(r,t){const{containerStyle:a,wrapperProps:c,scrollTo:n,calculateRange:e,currentList:o,containerRef:l,scaleTo:u,state:s,onUpdate:v}="itemHeight"in t?F(t,r):_(t,r);return{onUpdate:v,state:s,scaleTo:u,list:o,scrollTo:n,containerProps:{ref:l,onScroll:()=>{e()},style:a},wrapperProps:c}}function $(r){const t=f.ref(null),a=G.useElementSize(t),c=f.ref([]),n=f.shallowRef(r);return{state:f.ref({start:0,end:10,current:0,scale:1}),source:n,currentList:c,size:a,containerRef:t}}function P(r,t,a){return c=>{const{start:n=0,scale:e=1}=r.value;if(typeof a=="number")return Math.ceil(c/(a*e));let o=0,l=0;for(let u=n;u<t.value.length;u++){const s=a(u)*e;if(o+=s,l=u,o>c)break}return l-n}}function k(r,t,a){return c=>{const{scale:n=1}=a.value;if(typeof t=="number")return Math.floor(c/(t*n))+1;let e=0,o=0;for(let l=0;l<r.value.length;l++){const u=t(l)*n;if(e+=u,e>c){o=l;break}}return o+1}}function x(r,t,a,c,{containerRef:n,state:e,currentList:o,source:l},u){return()=>{const s=n.value;if(s){const v=a(Math.ceil(r==="vertical"?s.scrollTop:s.scrollLeft)),i=c(r==="vertical"?s.clientHeight:s.clientWidth),g=v-t,h=v+i+t;e.value={start:g<0?0:g,end:h>l.value.length?l.value.length:h,current:v-1,scale:e.value.scale},o.value=l.value.slice(e.value.start,e.value.end).map((d,p)=>({data:d,index:p+e.value.start})),u(e.value)}}}function z(r,t,a){return c=>{const{scale:n=1}=a.value;if(typeof r=="number"){const o=c*(r*n);return Math.ceil(o)}const e=t.value.slice(0,c).reduce((o,l,u)=>o+r(u)*n,0);return Math.ceil(e)}}function E(r,t,a,c){f.watch([r.width,r.height,t,a],()=>{c()})}function W(r,t,a){return f.computed(()=>{const{scale:c=1}=a.value;return typeof r=="number"?t.value.length*r*c:t.value.reduce((n,e,o)=>n+r(o)*c,0)})}const U={horizontal:"scrollLeft",vertical:"scrollTop"};function q(r,t,a,c){return n=>{if(c.value){if(n<0)return;const e=a(n);c.value[U[r]]=e,t()}}}function _(r,t){const{on:a,trigger:c}=O.createEventHook(),n=$(t),{state:e,source:o,currentList:l,size:u,containerRef:s}=n,v={overflowX:"auto"},{itemWidth:i,overscan:g=5}=r,h=P(e,o,i),d=k(o,i,e),p=x("horizontal",g,d,h,n,c),m=z(i,o,e),T=f.computed(()=>m(e.value.start)),b=W(i,o,e);E(u,t,s,p);const R=q("horizontal",p,m,s),V=y=>{e.value.scale=y},H=f.computed(()=>({style:{height:"100%",width:`${b.value-T.value}px`,marginLeft:`${T.value}px`,display:"flex",transform:`scale(${e.value.scale})`,transformOrigin:"0% 0%"}}));return{onUpdate:a,state:e,scaleTo:V,scrollTo:R,calculateRange:p,wrapperProps:H,containerStyle:v,currentList:l,containerRef:s}}function F(r,t){const{on:a,trigger:c}=O.createEventHook(),n=$(t),{state:e,source:o,currentList:l,size:u,containerRef:s}=n,v={overflowY:"auto"},{itemHeight:i,overscan:g=5}=r,h=P(e,o,i),d=k(o,i,e),p=x("vertical",g,d,h,n,c),m=z(i,o,e),T=f.computed(()=>m(e.value.start)),b=W(i,o,e);E(u,t,s,p);const R=q("vertical",p,m,s),V=y=>{const L=s.value;if(L){const{current:M}=e.value;let w=0;typeof i=="number"?w=M*(y*i-e.value.scale*i):w=o.value.slice(0,M).reduce((D,X,C)=>D+y*i(C)-e.value.scale*i(C),0),L.scrollTop=L.scrollTop+w>=0?L.scrollTop+w:0,e.value.scale=y}},H=f.computed(()=>({style:{height:`${b.value-T.value}px`,marginTop:`${T.value}px`,transform:`translateX(-50%) scale(${e.value.scale})`,transformOrigin:"50% 0%"}}));return{onUpdate:a,state:e,scaleTo:V,calculateRange:p,scrollTo:R,containerStyle:v,wrapperProps:H,currentList:l,containerRef:s}}exports.useVirtualList=S;
|