@solar-taro/ui-sun 1.2.1 → 1.2.2
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 +4 -0
- package/index18.js +42 -43
- package/index21.js +1 -1
- package/index24.js +1 -1
- package/index25.js +1 -1
- package/index26.js +1 -1
- package/index27.js +1 -1
- package/index28.js +1 -1
- package/index29.js +1 -1
- package/index30.js +1 -1
- package/index31.js +1 -1
- package/index32.js +1 -1
- package/index33.js +1 -1
- package/index34.js +1 -1
- package/index35.js +1 -1
- package/index36.js +1 -1
- package/index37.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/index18.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as F, ref as f, computed as
|
|
1
|
+
import { defineComponent as F, ref as f, computed as n, onMounted as P, renderList as V, Fragment as I, openBlock as L, createElementBlock as N, renderSlot as D, normalizeStyle as M, createCommentVNode as A, toDisplayString as E, createTextVNode as K, unref as R, withCtx as j, createBlock as q, mergeProps as O } from "vue";
|
|
2
2
|
import { withPixel as S } from "@solar-kit/core";
|
|
3
|
-
import { rpxToPx as
|
|
4
|
-
import { createSelectorQuery as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
key:
|
|
3
|
+
import { rpxToPx as Q, vibrator as W } from "@solar-taro/core";
|
|
4
|
+
import { createSelectorQuery as X } from "@tarojs/taro";
|
|
5
|
+
import Y from "./index13.js";
|
|
6
|
+
const G = V, H = I, a = L, u = N, w = D, h = M, J = A, U = E, Z = K, k = R, ee = j, te = q, re = O, le = ["id", "refresher-enabled", "refresher-triggered", "refresher-background", "scroll-x", "scroll-y"], oe = {
|
|
7
|
+
key: 1,
|
|
8
8
|
class: "sun-virtual-scroll-placeholder",
|
|
9
9
|
style: { display: "flex", "justify-content": "center", "align-items": "center", height: "85%" }
|
|
10
10
|
};
|
|
11
|
-
let
|
|
12
|
-
const
|
|
11
|
+
let ie = 1;
|
|
12
|
+
const me = /* @__PURE__ */ F({
|
|
13
13
|
__name: "index",
|
|
14
14
|
props: {
|
|
15
15
|
refreshing: { type: Boolean },
|
|
@@ -19,49 +19,49 @@ const de = /* @__PURE__ */ F({
|
|
|
19
19
|
items: {},
|
|
20
20
|
itemSize: {},
|
|
21
21
|
itemKey: {},
|
|
22
|
-
id: { default: () => `sun-virtual-scroll-${
|
|
22
|
+
id: { default: () => `sun-virtual-scroll-${ie++}` },
|
|
23
23
|
bottomSpace: { default: 0 },
|
|
24
24
|
loading: { type: Boolean },
|
|
25
25
|
loadingText: { default: "Loading" }
|
|
26
26
|
},
|
|
27
27
|
emits: ["refresh", "lower"],
|
|
28
|
-
setup(
|
|
29
|
-
const
|
|
28
|
+
setup(b, { emit: z }) {
|
|
29
|
+
const p = z, r = b;
|
|
30
30
|
let c;
|
|
31
|
-
const
|
|
31
|
+
const s = f(0), m = f(0), d = f(0), l = n(() => r.direction === "vertical"), B = n(() => ({
|
|
32
32
|
right: l.value ? "0" : "auto",
|
|
33
33
|
transform: `translate${l.value ? "Y" : "X"}(${d.value}px)`,
|
|
34
34
|
"white-space": l.value ? "normal" : "nowrap"
|
|
35
|
-
})),
|
|
36
|
-
[l.value ? "height" : "width"]: S(
|
|
37
|
-
})), C =
|
|
35
|
+
})), i = n(() => typeof r.itemSize == "number" ? r.itemSize : r.itemSize.endsWith("rpx") ? Q(parseFloat(r.itemSize)) : parseFloat(r.itemSize)), $ = n(() => i.value * r.items.length), x = n(() => ({
|
|
36
|
+
[l.value ? "height" : "width"]: S($.value + r.bottomSpace)
|
|
37
|
+
})), C = n(() => ({
|
|
38
38
|
display: l.value ? "block" : "inline-block",
|
|
39
|
-
[l.value ? "height" : "width"]: S(
|
|
40
|
-
})),
|
|
39
|
+
[l.value ? "height" : "width"]: S(i.value)
|
|
40
|
+
})), _ = n(
|
|
41
41
|
() => r.items.slice(
|
|
42
|
-
Math.max(m.value -
|
|
43
|
-
m.value +
|
|
42
|
+
Math.max(m.value - s.value, 0),
|
|
43
|
+
m.value + s.value * 2
|
|
44
44
|
)
|
|
45
45
|
);
|
|
46
46
|
function T({ detail: e }) {
|
|
47
47
|
c && cancelAnimationFrame(c), c = requestAnimationFrame(() => {
|
|
48
48
|
const t = l.value ? e.scrollTop : e.scrollLeft;
|
|
49
|
-
m.value = ~~(t /
|
|
49
|
+
m.value = ~~(t / i.value), m.value > s.value - 1 ? d.value = t - i.value * s.value - t % i.value : d.value = t - t % (i.value * s.value), c = 0;
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
function g() {
|
|
53
53
|
setTimeout(() => {
|
|
54
|
-
|
|
54
|
+
X().select(`#${r.id}`).boundingClientRect((e) => {
|
|
55
55
|
if (e = e, !(e != null && e.height) || !(e != null && e.width))
|
|
56
56
|
return g();
|
|
57
57
|
const { height: t, width: o } = e, v = l.value ? t : o;
|
|
58
|
-
|
|
58
|
+
s.value = Math.ceil(v / i.value);
|
|
59
59
|
}).exec();
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
return
|
|
62
|
+
return P(() => {
|
|
63
63
|
g();
|
|
64
|
-
}), (e, t) => (
|
|
64
|
+
}), (e, t) => (a(), u("scroll-view", re(e.$attrs, {
|
|
65
65
|
id: e.id,
|
|
66
66
|
class: "sun-virtual-scroll",
|
|
67
67
|
"refresher-enabled": e.refresher,
|
|
@@ -70,24 +70,24 @@ const de = /* @__PURE__ */ F({
|
|
|
70
70
|
"scroll-x": !l.value,
|
|
71
71
|
"scroll-y": l.value,
|
|
72
72
|
enhanced: !0,
|
|
73
|
-
"enable-passive": !0,
|
|
74
73
|
"lower-threshold": 300,
|
|
75
74
|
onScrollPassive: t[0] || (t[0] = (o) => T(o)),
|
|
76
75
|
onRefresherrefresh: t[1] || (t[1] = (o) => {
|
|
77
|
-
k(
|
|
76
|
+
k(W).short("light"), p("refresh");
|
|
78
77
|
}),
|
|
79
|
-
onScrolltolower: t[2] || (t[2] = (o) =>
|
|
78
|
+
onScrolltolower: t[2] || (t[2] = (o) => p("lower"))
|
|
80
79
|
}), [
|
|
81
|
-
|
|
80
|
+
e.items.length ? (a(), u("view", {
|
|
81
|
+
key: 0,
|
|
82
82
|
class: "sun-virtual-scroll-content-container",
|
|
83
|
-
style:
|
|
83
|
+
style: h(B.value)
|
|
84
84
|
}, [
|
|
85
|
-
(
|
|
85
|
+
(a(!0), u(H, null, G(_.value, (o, v) => {
|
|
86
86
|
var y;
|
|
87
|
-
return
|
|
87
|
+
return a(), u("view", {
|
|
88
88
|
key: (y = o[e.itemKey]) != null ? y : v,
|
|
89
89
|
class: "sun-virtual-scroll-item",
|
|
90
|
-
style:
|
|
90
|
+
style: h(C.value)
|
|
91
91
|
}, [
|
|
92
92
|
w(e.$slots, "default", {
|
|
93
93
|
item: o,
|
|
@@ -95,26 +95,25 @@ const de = /* @__PURE__ */ F({
|
|
|
95
95
|
})
|
|
96
96
|
], 4);
|
|
97
97
|
}), 128))
|
|
98
|
-
], 4),
|
|
99
|
-
|
|
100
|
-
e.loading ? (s(), le(k(H), {
|
|
98
|
+
], 4)) : (a(), u("view", oe, [
|
|
99
|
+
e.loading ? (a(), te(k(Y), {
|
|
101
100
|
key: 0,
|
|
102
101
|
spinning: !0
|
|
103
102
|
}, {
|
|
104
|
-
default:
|
|
105
|
-
|
|
103
|
+
default: ee(() => [
|
|
104
|
+
Z(U(e.loadingText), 1)
|
|
106
105
|
]),
|
|
107
106
|
_: 1
|
|
108
107
|
})) : w(e.$slots, "empty", { key: 1 })
|
|
109
108
|
])),
|
|
110
|
-
e.items.length ? (
|
|
111
|
-
key:
|
|
109
|
+
e.items.length ? (a(), u("view", {
|
|
110
|
+
key: 2,
|
|
112
111
|
class: "sun-virtual-scroll-spacer",
|
|
113
|
-
style:
|
|
114
|
-
}, null, 4)) :
|
|
115
|
-
], 16,
|
|
112
|
+
style: h(x.value)
|
|
113
|
+
}, null, 4)) : J("", !0)
|
|
114
|
+
], 16, le));
|
|
116
115
|
}
|
|
117
116
|
});
|
|
118
117
|
export {
|
|
119
|
-
|
|
118
|
+
me as default
|
|
120
119
|
};
|
package/index21.js
CHANGED
package/index24.js
CHANGED
package/index25.js
CHANGED
package/index26.js
CHANGED
package/index27.js
CHANGED
package/index28.js
CHANGED
package/index29.js
CHANGED
package/index30.js
CHANGED
package/index31.js
CHANGED
package/index32.js
CHANGED
package/index33.js
CHANGED
package/index34.js
CHANGED
package/index35.js
CHANGED
package/index36.js
CHANGED
package/index37.js
CHANGED