@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.
Files changed (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/components/scale-virtual-list/component/scale-virtual-list.vue2.mjs +28 -26
  3. package/dist/es/components/scale-virtual-list/hooks/useVirtualList.mjs +101 -97
  4. package/dist/es/node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.4.38/node_modules/@vueuse/shared/index.mjs +1189 -0
  5. package/dist/lib/node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.4.38/node_modules/@vueuse/shared/index.js +1 -0
  6. package/dist/lib/packages/antdv/components/scale-virtual-list/component/scale-virtual-list.vue2.js +1 -0
  7. package/dist/lib/packages/antdv/components/scale-virtual-list/hooks/useVirtualList.js +1 -0
  8. package/dist/theme-chalk/index.css +1 -1
  9. package/dist/theme-chalk/scale-virtual-list.css +1 -1
  10. package/dist/types/components/scale-virtual-list/component/scale-virtual-list.vue.d.ts +8 -2
  11. package/dist/types/components/scale-virtual-list/hooks/useVirtualList.d.ts +3 -2
  12. package/dist/types/components/scale-virtual-list/index.d.ts +23 -8
  13. package/package.json +1 -1
  14. package/dist/lib/components/scale-virtual-list/component/scale-virtual-list.vue2.js +0 -1
  15. package/dist/lib/components/scale-virtual-list/hooks/useVirtualList.js +0 -1
  16. /package/dist/lib/{components → packages/antdv/components}/base/style/index.js +0 -0
  17. /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/hooks/use-collapse-transtion.js +0 -0
  18. /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/index.js +0 -0
  19. /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/src/collapse-transtion.vue.js +0 -0
  20. /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/src/collapse-transtion.vue2.js +0 -0
  21. /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/src/types.js +0 -0
  22. /package/dist/lib/{components → packages/antdv/components}/collapse-transtion/style/index.js +0 -0
  23. /package/dist/lib/{components → packages/antdv/components}/form/component/form.js +0 -0
  24. /package/dist/lib/{components → packages/antdv/components}/form/component/form.vue.js +0 -0
  25. /package/dist/lib/{components → packages/antdv/components}/form/component/form.vue2.js +0 -0
  26. /package/dist/lib/{components → packages/antdv/components}/form/index.js +0 -0
  27. /package/dist/lib/{components → packages/antdv/components}/index.js +0 -0
  28. /package/dist/lib/{components → packages/antdv/components}/pro-dialog/hooks/useProDialog.js +0 -0
  29. /package/dist/lib/{components → packages/antdv/components}/pro-dialog/index.js +0 -0
  30. /package/dist/lib/{components → packages/antdv/components}/pro-dialog/src/pro-dialog.vue.js +0 -0
  31. /package/dist/lib/{components → packages/antdv/components}/pro-dialog/src/pro-dialog.vue2.js +0 -0
  32. /package/dist/lib/{components → packages/antdv/components}/pro-dialog/src/types.js +0 -0
  33. /package/dist/lib/{components → packages/antdv/components}/scale-virtual-list/component/scale-virtual-list.vue.js +0 -0
  34. /package/dist/lib/{components → packages/antdv/components}/scale-virtual-list/component/types.js +0 -0
  35. /package/dist/lib/{components → packages/antdv/components}/scale-virtual-list/index.js +0 -0
  36. /package/dist/lib/{components → packages/antdv/components}/scale-virtual-list/style/index.js +0 -0
  37. /package/dist/lib/{components → packages/antdv/components}/scroll-bar/index.js +0 -0
  38. /package/dist/lib/{components → packages/antdv/components}/scroll-bar/src/scroll-bar.js +0 -0
  39. /package/dist/lib/{components → packages/antdv/components}/scroll-bar/src/types.js +0 -0
  40. /package/dist/lib/{components → packages/antdv/components}/utils/install.js +0 -0
  41. /package/dist/lib/{components → packages/antdv/components}/virtual-list/index.js +0 -0
  42. /package/dist/lib/{components → packages/antdv/components}/virtual-list/src/types.js +0 -0
  43. /package/dist/lib/{components → packages/antdv/components}/virtual-list/src/virtual-list.vue.js +0 -0
  44. /package/dist/lib/{components → packages/antdv/components}/virtual-list/src/virtual-list.vue2.js +0 -0
  45. /package/dist/lib/{hooks → packages/antdv/hooks}/use-namespace/index.js +0 -0
  46. /package/dist/lib/{index.js → packages/antdv/index.js} +0 -0
  47. /package/dist/lib/{installer.js → packages/antdv/installer.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @king-one/antdv
2
2
 
3
+ ## 1.0.28
4
+
5
+ ### Patch Changes
6
+
7
+ - feat:修改虚拟列表样式
8
+
9
+ ## 1.0.27
10
+
11
+ ### Patch Changes
12
+
13
+ - feat: 虚拟列表组件增加 update⌚️
14
+
3
15
  ## 1.0.26
4
16
 
5
17
  ### Patch Changes
@@ -1,44 +1,46 @@
1
- import { defineComponent as _, toRefs as $, openBlock as s, createElementBlock as r, mergeProps as a, unref as e, createElementVNode as n, normalizeClass as k, Fragment as P, renderList as g, renderSlot as w } from "vue";
2
- import { defaultNamespace as o } from "../../../hooks/use-namespace/index.mjs";
3
- import { useVirtualList as B } from "../hooks/useVirtualList.mjs";
4
- const T = /* @__PURE__ */ _({
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
- setup(i, { expose: c }) {
11
- const l = i, { list: p } = $(l), { list: u, containerProps: d, wrapperProps: m, scrollTo: f, scaleTo: v } = B(p, l.option);
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: f,
14
- scaleTo: v
15
- }), (x, C) => (s(), r(
14
+ scrollTo: _,
15
+ scaleTo: $,
16
+ state: k
17
+ }), P((t) => d("update:state", t)), (t, T) => (r(), o(
16
18
  "div",
17
- a({
18
- class: `${e(o)}-scale-virtual-list`
19
- }, e(d)),
19
+ n({
20
+ class: `${e(a)}-scale-virtual-list`
21
+ }, e(v)),
20
22
  [
21
- n(
23
+ i(
22
24
  "div",
23
25
  {
24
- class: k(`${e(o)}-scale-virtual-list-container`)
26
+ class: B(`${e(a)}-scale-virtual-list-container`)
25
27
  },
26
28
  [
27
- n(
29
+ i(
28
30
  "div",
29
- a({
30
- class: `${e(o)}-scale-vittual-wrapper`
31
- }, e(m)),
31
+ n({
32
+ class: `${e(a)}-scale-vittual-wrapper`
33
+ }, e(x)),
32
34
  [
33
- (s(!0), r(
34
- P,
35
+ (r(!0), o(
36
+ C,
35
37
  null,
36
- g(e(u), (t) => (s(), r("div", {
37
- key: t.index
38
+ E(e(f), (s) => (r(), o("div", {
39
+ key: s.index
38
40
  }, [
39
- w(x.$slots, "default", {
40
- item: t,
41
- index: t.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
- T as default
64
+ z as default
63
65
  };
@@ -1,109 +1,111 @@
1
- import { ref as b, shallowRef as k, watch as E, computed as y } from "vue-demi";
2
- import { useElementSize as F } from "@vueuse/core";
3
- function q(n, t) {
4
- const { containerStyle: c, wrapperProps: e, scrollTo: r, calculateRange: a, currentList: u, containerRef: o, scaleTo: s, state: l } = "itemHeight" in t ? K(t, n) : X(t, n);
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
- state: l,
7
- scaleTo: s,
8
- list: u,
9
- scrollTo: r,
7
+ onUpdate: f,
8
+ state: s,
9
+ scaleTo: u,
10
+ list: n,
11
+ scrollTo: c,
10
12
  containerProps: {
11
- ref: o,
13
+ ref: l,
12
14
  onScroll: () => {
13
- a();
15
+ e();
14
16
  },
15
- style: c
17
+ style: a
16
18
  },
17
- wrapperProps: e
19
+ wrapperProps: o
18
20
  };
19
21
  }
20
- function C(n) {
21
- const t = b(null), c = F(t), e = b([]), r = k(n);
22
- return { state: b({ start: 0, end: 10, current: 0, scale: 1 }), source: r, currentList: e, size: c, containerRef: t };
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 $(n, t, c) {
25
- return (e) => {
26
- const { start: r = 0, scale: a = 1 } = n.value;
27
- if (typeof c == "number")
28
- return Math.ceil(e / (c * a));
29
- let u = 0, o = 0;
30
- for (let s = r; s < t.value.length; s++) {
31
- const l = c(s) * a;
32
- if (u += l, o = s, u > e)
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 o - r;
37
+ return l - c;
36
38
  };
37
39
  }
38
- function H(n, t, c) {
39
- return (e) => {
40
- const { scale: r = 1 } = c.value;
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(e / (t * r)) + 1;
43
- let a = 0, u = 0;
44
- for (let o = 0; o < n.value.length; o++) {
45
- const s = t(o) * r;
46
- if (a += s, a >= e) {
47
- u = o;
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 u + 1;
53
+ return n + 1;
52
54
  };
53
55
  }
54
- function O(n, t, c, e, { containerRef: r, state: a, currentList: u, source: o }) {
56
+ function k(r, t, a, o, { containerRef: c, state: e, currentList: n, source: l }, u) {
55
57
  return () => {
56
- const s = r.value;
58
+ const s = c.value;
57
59
  if (s) {
58
- const l = c(n === "vertical" ? s.scrollTop : s.scrollLeft), h = e(n === "vertical" ? s.clientHeight : s.clientWidth), v = l - t, p = l + h + t;
59
- a.value = {
60
- start: v < 0 ? 0 : v,
61
- end: p > o.value.length ? o.value.length : p,
62
- current: l - 1,
63
- scale: a.value.scale
64
- }, u.value = o.value.slice(a.value.start, a.value.end).map((i, f) => ({
65
- data: i,
66
- index: f + a.value.start
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 P(n, t, c) {
72
- return (e) => {
73
- const { scale: r = 1 } = c.value;
74
- return typeof n == "number" ? e * (n * r) : t.value.slice(0, e).reduce((u, o, s) => u + n(s) * r, 0);
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 W(n, t, c, e) {
78
- E([n.width, n.height, t, c], () => {
79
- e();
79
+ function E(r, t, a, o) {
80
+ M([r.width, r.height, t, a], () => {
81
+ o();
80
82
  });
81
83
  }
82
- function D(n, t, c) {
84
+ function G(r, t, a) {
83
85
  return y(() => {
84
- const { scale: e = 1 } = c.value;
85
- return typeof n == "number" ? t.value.length * n * e : t.value.reduce((r, a, u) => r + n(u) * e, 0);
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 M = {
90
+ const S = {
89
91
  horizontal: "scrollLeft",
90
92
  vertical: "scrollTop"
91
93
  };
92
- function G(n, t, c, e) {
93
- return (r) => {
94
- e.value && (e.value[M[n]] = c(r), t());
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(n, t) {
98
- const c = C(t), { state: e, source: r, currentList: a, size: u, containerRef: o } = c, s = { overflowX: "auto" }, { itemWidth: l, overscan: h = 5 } = n, v = $(e, r, l), p = H(r, l, e), i = O("horizontal", h, p, v, c), f = P(l, r, e), g = y(() => f(e.value.start)), w = D(l, r, e);
99
- W(u, t, o, i);
100
- const L = G("horizontal", i, f, o), R = (m) => {
101
- e.value.scale = m;
102
- }, V = y(() => ({
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: `${w.value - g.value}px`,
106
- marginLeft: `${g.value}px`,
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: R,
117
- scrollTo: L,
118
- calculateRange: i,
119
- wrapperProps: V,
120
- containerStyle: s,
121
- currentList: a,
122
- containerRef: o
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 K(n, t) {
126
- const c = C(t), { state: e, source: r, currentList: a, size: u, containerRef: o } = c, s = { overflowY: "auto" }, { itemHeight: l, overscan: h = 5 } = n, v = $(e, r, l), p = H(r, l, e), i = O("vertical", h, p, v, c), f = P(l, r, e), g = y(() => f(e.value.start)), w = D(l, r, e);
127
- W(u, t, o, i);
128
- const L = G("vertical", i, f, o), R = (m) => {
129
- const T = o.value;
130
- if (T) {
131
- const { current: x } = e.value;
132
- let d = 0;
133
- typeof l == "number" ? d = x * (m * l - e.value.scale * l) : d = r.value.slice(0, x).reduce((_, S, z) => _ + m * l(z) - e.value.scale * l(z), 0), T.scrollTop = T.scrollTop + d >= 0 ? T.scrollTop + d : 0, e.value.scale = m;
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
- }, V = y(() => ({
138
+ }, x = y(() => ({
136
139
  style: {
137
- height: `${w.value - g.value}px`,
138
- marginTop: `${g.value}px`,
139
- transform: `translateX(-50%) scale(${e.value.scale})`,
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: R,
146
- calculateRange: i,
147
- scrollTo: L,
148
- containerStyle: s,
149
- wrapperProps: V,
150
- currentList: a,
151
- containerRef: o
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
- q as useVirtualList
159
+ I as useVirtualList
156
160
  };