@solar-taro/ui-sun 1.4.2 → 1.5.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 (66) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/index.d.ts +1 -0
  3. package/index.js +16 -14
  4. package/index11.js +1 -1
  5. package/index12.js +1 -1
  6. package/index13.js +142 -27
  7. package/index14.js +29 -21
  8. package/index15.js +18 -21
  9. package/index16.js +21 -9
  10. package/index17.js +10 -27
  11. package/index18.js +27 -114
  12. package/index19.js +123 -10
  13. package/index20.js +7 -7
  14. package/index21.js +10 -2
  15. package/index23.js +1 -1
  16. package/index24.js +1 -1
  17. package/index25.js +2 -7
  18. package/index26.js +7 -2
  19. package/index28.js +1 -1
  20. package/index29.js +1 -1
  21. package/index30.js +1 -1
  22. package/index31.js +1 -1
  23. package/index32.js +1 -1
  24. package/index33.js +1 -1
  25. package/index34.js +1 -1
  26. package/index35.js +1 -1
  27. package/index36.js +1 -1
  28. package/index37.js +1 -1
  29. package/index38.js +2 -3
  30. package/index39.js +4 -0
  31. package/index40.js +5 -0
  32. package/index41.js +68 -0
  33. package/index42.js +14 -0
  34. package/index43.js +27 -0
  35. package/index44.js +16 -0
  36. package/index45.js +7 -0
  37. package/index46.js +28 -0
  38. package/index47.js +4 -0
  39. package/index48.js +508 -0
  40. package/index49.js +81 -0
  41. package/index50.js +72 -0
  42. package/index51.js +71 -0
  43. package/index52.js +545 -0
  44. package/index53.js +4 -0
  45. package/index54.js +4 -0
  46. package/index55.js +4 -0
  47. package/index56.js +6 -0
  48. package/index57.js +4 -0
  49. package/index58.js +6 -0
  50. package/index59.js +4 -0
  51. package/index60.js +4 -0
  52. package/index61.js +4 -0
  53. package/index62.js +50 -0
  54. package/index63.js +84 -0
  55. package/index64.js +4 -0
  56. package/index65.js +4 -0
  57. package/index66.js +4 -0
  58. package/index67.js +4 -0
  59. package/package.json +6 -2
  60. package/segment/segment.vue.d.ts +1 -1
  61. package/slider-captcha/index.d.ts +1 -0
  62. package/slider-captcha/index.scss +98 -0
  63. package/slider-captcha/index.vue.d.ts +47 -0
  64. package/spinner/index.scss +2 -4
  65. package/spinner/index.vue.d.ts +22 -5
  66. package/virtual-scroll/index.vue.d.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.4.2 (2025-10-13)
2
+
3
+ This was a version bump only for ui-sun to align it with other projects, there were no code changes.
4
+
1
5
  ## 1.4.1 (2025-10-13)
2
6
 
3
7
  This was a version bump only for ui-sun to align it with other projects, there were no code changes.
package/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './navbar';
8
8
  export * from './plugin';
9
9
  export * from './popover';
10
10
  export * from './segment';
11
+ export * from './slider-captcha';
11
12
  export * from './spinner';
12
13
  export * from './sudoku';
13
14
  export * from './table';
package/index.js CHANGED
@@ -6,35 +6,37 @@ import { default as p } from "./index6.js";
6
6
  import { default as m } from "./index7.js";
7
7
  import { default as x } from "./index8.js";
8
8
  import { default as c } from "./index9.js";
9
- import { default as g } from "./index10.js";
9
+ import { default as C } from "./index10.js";
10
10
  import { default as T } from "./index11.js";
11
- import { default as v } from "./index12.js";
12
- import { default as I } from "./index13.js";
13
- import { default as R } from "./index14.js";
11
+ import { default as k } from "./index12.js";
12
+ import { default as F } from "./index13.js";
13
+ import { default as P } from "./index14.js";
14
14
  import { default as w } from "./index15.js";
15
15
  import { default as z } from "./index16.js";
16
16
  import { default as B } from "./index17.js";
17
17
  import { default as L } from "./index18.js";
18
18
  import { default as V } from "./index19.js";
19
19
  import { default as q } from "./index20.js";
20
+ import { default as E } from "./index21.js";
20
21
  export {
21
22
  e as SolarSun,
22
23
  u as SunAccordion,
23
24
  f as SunChip,
24
25
  S as SunCircularProgress,
25
- V as SunFab,
26
+ q as SunFab,
26
27
  p as SunFabGroup,
27
28
  m as SunIcon,
28
29
  x as SunLazyRender,
29
30
  c as SunNavbar,
30
- g as SunPopover,
31
- v as SunSegment,
31
+ C as SunPopover,
32
+ k as SunSegment,
32
33
  T as SunSegmentBtn,
33
- I as SunSpinner,
34
- R as SunSudoku,
35
- q as SunSudokuItem,
36
- B as SunTb,
37
- w as SunTbCell,
38
- z as SunTbRow,
39
- L as SunVirtualScroll
34
+ F as SunSliderCaptcha,
35
+ P as SunSpinner,
36
+ w as SunSudoku,
37
+ E as SunSudokuItem,
38
+ L as SunTb,
39
+ z as SunTbCell,
40
+ B as SunTbRow,
41
+ V as SunVirtualScroll
40
42
  };
package/index11.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as p, inject as a, getCurrentInstance as c, onUnmounted as m, unref as u, renderSlot as i, mergeProps as _, openBlock as f, createElementBlock as v } from "vue";
2
- import { ACTIVE_CHILD as d, PARENT as g } from "./index38.js";
2
+ import { ACTIVE_CHILD as d, PARENT as g } from "./index40.js";
3
3
  const o = u, k = i, C = _, B = f, E = v, $ = /* @__PURE__ */ p({
4
4
  __name: "segment-btn",
5
5
  props: {
package/index12.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as x, getCurrentInstance as V, shallowRef as E, shallowReactive as k, computed as a, provide as i, watch as C, onMounted as w, renderSlot as y, createElementVNode as B, mergeProps as I, openBlock as O, createElementBlock as A } from "vue";
2
- import { ACTIVE_CHILD as N, PARENT as P } from "./index38.js";
2
+ import { ACTIVE_CHILD as N, PARENT as P } from "./index40.js";
3
3
  const R = y, T = B, b = I, L = O, S = A, $ = { class: "sun-segment-inner" }, M = /* @__PURE__ */ x({
4
4
  __name: "segment",
5
5
  props: {
package/index13.js CHANGED
@@ -1,35 +1,150 @@
1
- import { defineComponent as a, computed as c, renderList as p, Fragment as m, openBlock as d, createElementBlock as u, createElementVNode as _, renderSlot as f, createCommentVNode as k, normalizeClass as g } from "vue";
2
- const v = p, B = m, e = d, n = u, o = _, C = f, N = k, w = g, z = { class: "sun-spinner-dot" }, E = {
3
- key: 0,
4
- class: "sun-spinner-desc"
5
- }, y = /* @__PURE__ */ a({
1
+ import { defineComponent as J, ref as d, computed as M, onMounted as q, onUnmounted as F, unref as K, normalizeStyle as O, createElementVNode as Q, openBlock as X, createBlock as Y, createCommentVNode as ee, toDisplayString as te, normalizeClass as ae, createElementBlock as ne } from "vue";
2
+ import { HttpClient as se, withInterceptors as oe } from "@ngify/http";
3
+ import { withPixel as B } from "@solar-kit/core";
4
+ import { CaptchaType as S } from "@solar-kit/planets/mercury";
5
+ import { filterResult as ie } from "@solar-kit/planets/sun";
6
+ import { useCommonInterceptor as re } from "@solar-taro/http";
7
+ import { SunSpinner as ce } from "@solar-taro/ui-sun";
8
+ import { createSelectorQuery as le, getWindowInfo as pe } from "@tarojs/taro";
9
+ import { a as ue } from "./index41.js";
10
+ import { e as D } from "./index42.js";
11
+ import de from "./index43.js";
12
+ import me from "./index44.js";
13
+ import { attachLoading as ve } from "./index45.js";
14
+ const g = K, H = O, o = Q, w = X, fe = Y, N = ee, he = te, U = ae, $ = ne, ye = { class: "sun-slider-captcha" }, ge = { class: "sun-slider-captcha-container" }, we = { class: "sun-slider-captcha-mask" }, ke = { class: "sun-slider-captcha-track" }, _e = ["x", "disabled"], V = "sun-slider-captcha", be = 155, Ie = 310, ze = 155, xe = 50, Le = /* @__PURE__ */ J({
6
15
  __name: "index",
7
16
  props: {
8
- size: {},
9
- spinning: { type: Boolean }
17
+ height: { default: 187.5 },
18
+ width: { default: 375 },
19
+ url: {},
20
+ verifyUrl: {},
21
+ verifyData: {}
10
22
  },
11
- setup(r) {
12
- const s = r, i = c(() => [
13
- {
14
- "sun-spinner-spinning": s.spinning
15
- },
16
- `sun-spinner-${s.size}`
17
- ]);
18
- return (t, V) => (e(), n("view", {
19
- class: w(["sun-spinner", i.value])
20
- }, [
21
- o("view", z, [
22
- (e(), n(B, null, v(4, (l) => o("view", {
23
- key: l,
24
- class: "sun-spinner-dot-item"
25
- })), 64))
23
+ emits: ["verified"],
24
+ setup(Z, { emit: L }) {
25
+ let c, p, m, v, k, _ = !1;
26
+ const i = Z, R = L, l = d(0), f = d(!1), b = d(!1), y = M(() => ({
27
+ width: i.width / Ie,
28
+ height: i.height / be
29
+ })), I = new se(
30
+ oe([
31
+ re()
32
+ ])
33
+ ), n = d({
34
+ visible: !1,
35
+ type: "success",
36
+ content: ""
37
+ }), h = d({ type: "primary" }), r = { key: "", token: "" };
38
+ function z() {
39
+ f.value = !0, I.post(i.url, { captchaType: S.BlockPuzzle }).pipe(
40
+ ie()
41
+ ).subscribe(async ({ data: t }) => {
42
+ r.key = t.secretKey, r.token = t.token, m = c.createImage(), v = c.createImage(), m.src = `data:image/png;base64,${t.originalImageBase64}`, v.src = `data:image/png;base64,${t.jigsawImageBase64}`, await Promise.all([
43
+ new Promise((e) => m.onload = () => e()),
44
+ new Promise((e) => v.onload = () => e())
45
+ ]), k = Date.now(), x(), f.value = !1;
46
+ });
47
+ }
48
+ function x(t = 0) {
49
+ const e = i.width, a = i.height;
50
+ p.clearRect(0, 0, e, a), p.drawImage(m, 0, 0, e, a), p.drawImage(v, t, 0, y.value.width * xe, y.value.height * ze), l.value = t;
51
+ }
52
+ function W(t) {
53
+ t = t / y.value.width;
54
+ const e = Date.now(), a = JSON.stringify({ x: t, y: 5 }), s = r.key ? E(a, r.key) : a, C = {
55
+ captchaType: S.BlockPuzzle,
56
+ pointJson: s,
57
+ token: r.token,
58
+ ...i.verifyData
59
+ };
60
+ I.post(i.verifyUrl, C).pipe(
61
+ ve(b)
62
+ ).subscribe({
63
+ next: (u) => {
64
+ if (u.code !== 0)
65
+ n.value.type = "danger", n.value.content = u.msg, n.value.visible = !0, h.value.type = "danger", setTimeout(() => {
66
+ n.value.visible = !1, z();
67
+ }, 1e3);
68
+ else {
69
+ const G = ((e - k) / 1e3).toFixed(2);
70
+ n.value.type = "success", n.value.content = `验证成功,耗时 ${G} 秒`, n.value.visible = !0, h.value.type = "primary";
71
+ const P = u.data.token + "---" + a;
72
+ u.data.captcha = r.key ? E(P, r.key) : P;
73
+ }
74
+ R("verified", u);
75
+ }
76
+ });
77
+ }
78
+ function E(t, e) {
79
+ const a = D.parse(e), s = D.parse(t);
80
+ return ue.encrypt(s, a, { mode: de, padding: me }).toString();
81
+ }
82
+ function j(t) {
83
+ l.value = t.x, x(l.value);
84
+ }
85
+ function A() {
86
+ W(l.value);
87
+ }
88
+ function T() {
89
+ setTimeout(() => {
90
+ le().select(`#${V}`).fields({ node: !0, size: !0 }).exec(([{ node: t, width: e, height: a }]) => {
91
+ if (_) return;
92
+ if (!a || !e)
93
+ return T();
94
+ const s = pe().pixelRatio;
95
+ c = t, p = c.getContext("2d"), c.width = e * s, c.height = a * s, p.scale(s, s), z();
96
+ });
97
+ }, 50);
98
+ }
99
+ return q(() => {
100
+ T();
101
+ }), F(() => {
102
+ _ = !0;
103
+ }), (t, e) => (w(), $("view", ye, [
104
+ o("view", ge, [
105
+ o("canvas", {
106
+ id: V,
107
+ type: "2d",
108
+ class: "sun-slider-captcha-canvas",
109
+ style: H({ height: g(B)(t.height), width: g(B)(t.width) })
110
+ }, null, 4),
111
+ o("view", we, [
112
+ f.value ? (w(), fe(g(ce), { key: 0 })) : N("", !0),
113
+ n.value.visible ? (w(), $("view", {
114
+ key: 1,
115
+ class: U(["sun-slider-captcha-alert", {
116
+ "sun-slider-captcha-alert-success": n.value.type === "success",
117
+ "sun-slider-captcha-alert-danger": n.value.type === "danger"
118
+ }])
119
+ }, he(n.value.content), 3)) : N("", !0)
120
+ ])
26
121
  ]),
27
- t.$slots.default ? (e(), n("view", E, [
28
- C(t.$slots, "default")
29
- ])) : N("", !0)
30
- ], 2));
122
+ o("movable-area", ke, [
123
+ e[3] || (e[3] = o("view", { class: "sun-slider-captcha-hint" }, "拖动滑块以完成拼图", -1)),
124
+ o("view", {
125
+ class: U(["sun-slider-captcha-indicator", {
126
+ "sun-slider-captcha-indicator-primary": h.value.type === "primary",
127
+ "sun-slider-captcha-indicator-danger": h.value.type === "danger"
128
+ }]),
129
+ style: H({ transform: `translateX(calc(-100% + ${l.value}px))` })
130
+ }, null, 6),
131
+ o("movable-view", {
132
+ class: "sun-slider-captcha-handler",
133
+ x: l.value,
134
+ direction: "horizontal",
135
+ disabled: f.value || b.value,
136
+ onChangePassive: e[0] || (e[0] = (a) => j(a.detail)),
137
+ onTouchendPassive: e[1] || (e[1] = (a) => A())
138
+ }, e[2] || (e[2] = [
139
+ o("van-icon", {
140
+ name: "wap-nav",
141
+ style: { transform: "rotate(90deg)" }
142
+ }, null, -1)
143
+ ]), 40, _e)
144
+ ])
145
+ ]));
31
146
  }
32
147
  });
33
148
  export {
34
- y as default
149
+ Le as default
35
150
  };
package/index14.js CHANGED
@@ -1,27 +1,35 @@
1
- import { defineComponent as u, computed as n, renderSlot as c, mergeProps as r, openBlock as l, createElementBlock as d } from "vue";
2
- const a = c, m = r, p = l, k = d, _ = /* @__PURE__ */ u({
3
- __name: "sudoku",
1
+ import { defineComponent as a, computed as c, renderList as d, Fragment as m, openBlock as p, createElementBlock as u, createElementVNode as _, renderSlot as f, createCommentVNode as k, normalizeClass as g } from "vue";
2
+ const v = d, B = m, e = p, n = u, o = _, C = f, N = k, w = g, z = { class: "sun-spinner-dot" }, E = {
3
+ key: 0,
4
+ class: "sun-spinner-desc"
5
+ }, y = /* @__PURE__ */ a({
6
+ __name: "index",
4
7
  props: {
5
- size: String,
6
- count: {
7
- type: Number,
8
- default: 9
9
- }
8
+ size: { default: "middle" },
9
+ spinning: { type: Boolean, default: !0 }
10
10
  },
11
- setup(o) {
12
- const e = o, t = n(() => ({
13
- "sun-sudoku-sm": e.count === 1,
14
- "sun-sudoku-md": e.count === 2 || e.count === 4,
15
- "sun-sudoku-lg": e.count === 3 || e.count > 4
16
- }));
17
- return (s, i) => (p(), k("view", m(s.$attrs, {
18
- class: ["sun-sudoku", t.value],
19
- style: { "--sudoku-width": o.size }
20
- }), [
21
- a(s.$slots, "default")
22
- ], 16));
11
+ setup(r) {
12
+ const s = r, l = c(() => [
13
+ {
14
+ "sun-spinner-spinning": s.spinning
15
+ },
16
+ `sun-spinner-${s.size}`
17
+ ]);
18
+ return (t, V) => (e(), n("view", {
19
+ class: w(["sun-spinner", l.value])
20
+ }, [
21
+ o("view", z, [
22
+ (e(), n(B, null, v(4, (i) => o("view", {
23
+ key: i,
24
+ class: "sun-spinner-dot-item"
25
+ })), 64))
26
+ ]),
27
+ t.$slots.default ? (e(), n("view", E, [
28
+ C(t.$slots, "default")
29
+ ])) : N("", !0)
30
+ ], 2));
23
31
  }
24
32
  });
25
33
  export {
26
- _ as default
34
+ y as default
27
35
  };
package/index15.js CHANGED
@@ -1,30 +1,27 @@
1
- import { defineComponent as o, computed as i, renderSlot as r, mergeProps as n, openBlock as c, createElementBlock as a } from "vue";
2
- const p = r, d = n, m = c, h = a, b = /* @__PURE__ */ o({
3
- __name: "table-cell",
1
+ import { defineComponent as u, computed as n, renderSlot as c, mergeProps as r, openBlock as l, createElementBlock as d } from "vue";
2
+ const a = c, m = r, p = l, k = d, _ = /* @__PURE__ */ u({
3
+ __name: "sudoku",
4
4
  props: {
5
- sticky: {},
6
- head: { type: Boolean },
7
- width: {},
8
- maxWidth: {},
9
- ellipsis: { type: Boolean },
10
- breakWord: { type: Boolean }
5
+ size: String,
6
+ count: {
7
+ type: Number,
8
+ default: 9
9
+ }
11
10
  },
12
- setup(l) {
13
- const e = l, s = i(() => ({
14
- "sun-tb-cell-sticky-left": e.sticky === "left",
15
- "sun-tb-cell-sticky-right": e.sticky === "right",
16
- "sun-tb-cell-ellipsis": e.ellipsis,
17
- "sun-tb-cell-head": e.ellipsis,
18
- "sun-tb-cell-break-word": e.breakWord
11
+ setup(o) {
12
+ const e = o, t = n(() => ({
13
+ "sun-sudoku-sm": e.count === 1,
14
+ "sun-sudoku-md": e.count === 2 || e.count === 4,
15
+ "sun-sudoku-lg": e.count === 3 || e.count > 4
19
16
  }));
20
- return (t, u) => (m(), h("view", d(t.$attrs, {
21
- class: ["sun-tb-cell", s.value],
22
- style: { width: t.width, "min-width": t.width, "max-width": t.maxWidth }
17
+ return (s, i) => (p(), k("view", m(s.$attrs, {
18
+ class: ["sun-sudoku", t.value],
19
+ style: { "--sudoku-width": o.size }
23
20
  }), [
24
- p(t.$slots, "default")
21
+ a(s.$slots, "default")
25
22
  ], 16));
26
23
  }
27
24
  });
28
25
  export {
29
- b as default
26
+ _ as default
30
27
  };
package/index16.js CHANGED
@@ -1,18 +1,30 @@
1
- import { defineComponent as o, renderSlot as t, mergeProps as r, openBlock as n, createElementBlock as s } from "vue";
2
- const a = t, l = r, p = n, c = s, u = /* @__PURE__ */ o({
3
- __name: "table-row",
1
+ import { defineComponent as o, computed as i, renderSlot as r, mergeProps as n, openBlock as c, createElementBlock as a } from "vue";
2
+ const p = r, d = n, m = c, h = a, b = /* @__PURE__ */ o({
3
+ __name: "table-cell",
4
4
  props: {
5
+ sticky: {},
5
6
  head: { type: Boolean },
6
- foot: { type: Boolean }
7
+ width: {},
8
+ maxWidth: {},
9
+ ellipsis: { type: Boolean },
10
+ breakWord: { type: Boolean }
7
11
  },
8
- setup(m) {
9
- return (e, d) => (p(), c("view", l(e.$attrs, {
10
- class: ["sun-tb-row", { "sun-tb-head": e.head, "sun-tb-foot": e.foot }]
12
+ setup(l) {
13
+ const e = l, s = i(() => ({
14
+ "sun-tb-cell-sticky-left": e.sticky === "left",
15
+ "sun-tb-cell-sticky-right": e.sticky === "right",
16
+ "sun-tb-cell-ellipsis": e.ellipsis,
17
+ "sun-tb-cell-head": e.ellipsis,
18
+ "sun-tb-cell-break-word": e.breakWord
19
+ }));
20
+ return (t, u) => (m(), h("view", d(t.$attrs, {
21
+ class: ["sun-tb-cell", s.value],
22
+ style: { width: t.width, "min-width": t.width, "max-width": t.maxWidth }
11
23
  }), [
12
- a(e.$slots, "default")
24
+ p(t.$slots, "default")
13
25
  ], 16));
14
26
  }
15
27
  });
16
28
  export {
17
- u as default
29
+ b as default
18
30
  };
package/index17.js CHANGED
@@ -1,35 +1,18 @@
1
- import { defineComponent as s, computed as o, renderSlot as l, normalizeClass as u, createElementVNode as d, mergeProps as b, openBlock as c, createElementBlock as p } from "vue";
2
- const m = l, i = u, B = d, _ = b, f = c, z = p, k = /* @__PURE__ */ s({
3
- __name: "table",
1
+ import { defineComponent as o, renderSlot as t, mergeProps as r, openBlock as n, createElementBlock as s } from "vue";
2
+ const a = t, l = r, p = n, c = s, u = /* @__PURE__ */ o({
3
+ __name: "table-row",
4
4
  props: {
5
- rounded: { type: Boolean, default: !0 },
6
- bordered: { type: Boolean },
7
- outerBordered: { type: Boolean, default: !0 },
8
- zebra: { type: Boolean },
9
- size: { default: "default" },
10
- layout: {}
5
+ head: { type: Boolean },
6
+ foot: { type: Boolean }
11
7
  },
12
- setup(r) {
13
- const e = r, n = o(() => ({
14
- "sun-tb-rounded": e.rounded,
15
- "sun-tb-bordered": e.bordered,
16
- "sun-tb-outer-bordered": e.outerBordered,
17
- [`sun-tb-size-${e.size}`]: e.size
18
- })), a = o(() => ({
19
- "sun-tb-zebra": e.zebra,
20
- [`sun-tb-layout-${e.layout}`]: e.layout
21
- }));
22
- return (t, y) => (f(), z("view", _(t.$attrs, {
23
- class: ["sun-tb", n.value]
8
+ setup(m) {
9
+ return (e, d) => (p(), c("view", l(e.$attrs, {
10
+ class: ["sun-tb-row", { "sun-tb-head": e.head, "sun-tb-foot": e.foot }]
24
11
  }), [
25
- B("view", {
26
- class: i(["sun-tb-inner", a.value])
27
- }, [
28
- m(t.$slots, "default")
29
- ], 2)
12
+ a(e.$slots, "default")
30
13
  ], 16));
31
14
  }
32
15
  });
33
16
  export {
34
- k as default
17
+ u as default
35
18
  };
package/index18.js CHANGED
@@ -1,122 +1,35 @@
1
- import { defineComponent as P, ref as f, computed as i, onMounted as V, onUnmounted as I, renderList as L, Fragment as N, openBlock as D, createElementBlock as M, renderSlot as A, normalizeStyle as E, createCommentVNode as K, toDisplayString as R, createTextVNode as j, unref as q, withCtx as O, createBlock as Q, mergeProps as U } from "vue";
2
- import { withPixel as w } from "@solar-kit/core";
3
- import { rpxToPx as W, vibrator as X } from "@solar-taro/core";
4
- import { createSelectorQuery as Y } from "@tarojs/taro";
5
- import G from "./index13.js";
6
- const H = L, J = N, a = D, u = M, k = A, h = E, Z = K, ee = R, te = j, b = q, re = O, le = Q, oe = U, ne = ["id", "refresher-enabled", "refresher-triggered", "refresher-background", "scroll-x", "scroll-y"], ie = {
7
- key: 1,
8
- class: "sun-virtual-scroll-placeholder",
9
- style: { display: "flex", "justify-content": "center", "align-items": "center", height: "85%" }
10
- };
11
- let ae = 1;
12
- const ve = /* @__PURE__ */ P({
13
- __name: "index",
1
+ import { defineComponent as s, computed as o, renderSlot as l, normalizeClass as u, createElementVNode as d, mergeProps as b, openBlock as c, createElementBlock as p } from "vue";
2
+ const m = l, i = u, B = d, _ = b, f = c, z = p, k = /* @__PURE__ */ s({
3
+ __name: "table",
14
4
  props: {
15
- refreshing: { type: Boolean },
16
- refresher: { type: Boolean },
17
- refresherBg: { default: "transparent" },
18
- direction: { default: "vertical" },
19
- items: {},
20
- itemSize: {},
21
- itemKey: {},
22
- id: { default: () => `sun-virtual-scroll-${ae++}` },
23
- bottomSpace: { default: 0 },
24
- loading: { type: Boolean },
25
- loadingText: { default: "Loading" }
5
+ rounded: { type: Boolean, default: !0 },
6
+ bordered: { type: Boolean },
7
+ outerBordered: { type: Boolean, default: !0 },
8
+ zebra: { type: Boolean },
9
+ size: { default: "default" },
10
+ layout: {}
26
11
  },
27
- emits: ["refresh", "lower"],
28
- setup(z, { emit: B }) {
29
- const p = B, r = z;
30
- let c, g = !1;
31
- const s = f(0), m = f(0), v = f(0), l = i(() => r.direction === "vertical"), $ = i(() => ({
32
- right: l.value ? "0" : "auto",
33
- transform: `translate${l.value ? "Y" : "X"}(${v.value}px)`,
34
- "white-space": l.value ? "normal" : "nowrap"
35
- })), n = i(() => typeof r.itemSize == "number" ? r.itemSize : r.itemSize.endsWith("rpx") ? W(parseFloat(r.itemSize)) : parseFloat(r.itemSize)), x = i(() => n.value * r.items.length), C = i(() => ({
36
- [l.value ? "height" : "width"]: w(x.value + r.bottomSpace)
37
- })), _ = i(() => ({
38
- display: l.value ? "block" : "inline-block",
39
- [l.value ? "height" : "width"]: w(n.value)
40
- })), T = i(
41
- () => r.items.slice(
42
- Math.max(m.value - s.value, 0),
43
- m.value + s.value * 2
44
- )
45
- );
46
- function F({ detail: e }) {
47
- c && cancelAnimationFrame(c), c = requestAnimationFrame(() => {
48
- const t = l.value ? e.scrollTop : e.scrollLeft;
49
- m.value = ~~(t / n.value), m.value > s.value - 1 ? v.value = t - n.value * s.value - t % n.value : v.value = t - t % (n.value * s.value), c = 0;
50
- });
51
- }
52
- function y() {
53
- setTimeout(() => {
54
- Y().select(`#${r.id}`).boundingClientRect((e) => {
55
- if (g) return;
56
- if (e = e, !(e != null && e.height) || !(e != null && e.width))
57
- return y();
58
- const { height: t, width: o } = e, d = l.value ? t : o;
59
- s.value = Math.ceil(d / n.value);
60
- }).exec();
61
- }, 50);
62
- }
63
- return V(() => {
64
- y();
65
- }), I(() => {
66
- g = !0;
67
- }), (e, t) => (a(), u("scroll-view", oe(e.$attrs, {
68
- id: e.id,
69
- class: "sun-virtual-scroll",
70
- "refresher-enabled": e.refresher,
71
- "refresher-triggered": e.refreshing,
72
- "refresher-background": e.refresherBg,
73
- "scroll-x": !l.value,
74
- "scroll-y": l.value,
75
- enhanced: !0,
76
- "lower-threshold": 300,
77
- onScrollPassive: t[0] || (t[0] = (o) => F(o)),
78
- onRefresherrefresh: t[1] || (t[1] = (o) => {
79
- b(X).short("light"), p("refresh");
80
- }),
81
- onScrolltolower: t[2] || (t[2] = (o) => p("lower"))
12
+ setup(r) {
13
+ const e = r, n = o(() => ({
14
+ "sun-tb-rounded": e.rounded,
15
+ "sun-tb-bordered": e.bordered,
16
+ "sun-tb-outer-bordered": e.outerBordered,
17
+ [`sun-tb-size-${e.size}`]: e.size
18
+ })), a = o(() => ({
19
+ "sun-tb-zebra": e.zebra,
20
+ [`sun-tb-layout-${e.layout}`]: e.layout
21
+ }));
22
+ return (t, y) => (f(), z("view", _(t.$attrs, {
23
+ class: ["sun-tb", n.value]
82
24
  }), [
83
- e.items.length ? (a(), u("view", {
84
- key: 0,
85
- class: "sun-virtual-scroll-content-container",
86
- style: h($.value)
25
+ B("view", {
26
+ class: i(["sun-tb-inner", a.value])
87
27
  }, [
88
- (a(!0), u(J, null, H(T.value, (o, d) => {
89
- var S;
90
- return a(), u("view", {
91
- key: (S = o[e.itemKey]) != null ? S : d,
92
- class: "sun-virtual-scroll-item",
93
- style: h(_.value)
94
- }, [
95
- k(e.$slots, "default", {
96
- item: o,
97
- index: d
98
- })
99
- ], 4);
100
- }), 128))
101
- ], 4)) : (a(), u("view", ie, [
102
- e.loading ? (a(), le(b(G), {
103
- key: 0,
104
- spinning: !0
105
- }, {
106
- default: re(() => [
107
- te(ee(e.loadingText), 1)
108
- ]),
109
- _: 1
110
- })) : k(e.$slots, "empty", { key: 1 })
111
- ])),
112
- e.items.length ? (a(), u("view", {
113
- key: 2,
114
- class: "sun-virtual-scroll-spacer",
115
- style: h(C.value)
116
- }, null, 4)) : Z("", !0)
117
- ], 16, ne));
28
+ m(t.$slots, "default")
29
+ ], 2)
30
+ ], 16));
118
31
  }
119
32
  });
120
33
  export {
121
- ve as default
34
+ k as default
122
35
  };