@king-one/antdv 1.0.27 → 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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @king-one/antdv
2
2
 
3
+ ## 1.0.28
4
+
5
+ ### Patch Changes
6
+
7
+ - feat:修改虚拟列表样式
8
+
3
9
  ## 1.0.27
4
10
 
5
11
  ### Patch Changes
@@ -1,13 +1,13 @@
1
1
  import { createEventHook as $ } from "../../../node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.4.38/node_modules/@vueuse/shared/index.mjs";
2
2
  import { ref as z, shallowRef as F, watch as M, computed as y } from "vue-demi";
3
- import { useElementSize as X } from "@vueuse/core";
3
+ import { useElementSize as K } from "@vueuse/core";
4
4
  function I(r, t) {
5
- const { containerStyle: a, wrapperProps: n, scrollTo: c, calculateRange: e, currentList: o, containerRef: l, scaleTo: u, state: s, onUpdate: f } = "itemHeight" in t ? Y(t, r) : S(t, r);
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);
6
6
  return {
7
7
  onUpdate: f,
8
8
  state: s,
9
9
  scaleTo: u,
10
- list: o,
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: n
19
+ wrapperProps: o
20
20
  };
21
21
  }
22
22
  function O(r) {
23
- const t = z(null), a = X(t), n = z([]), c = F(r);
24
- return { state: z({ start: 0, end: 10, current: 0, scale: 1 }), source: c, currentList: n, size: a, containerRef: t };
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 };
25
25
  }
26
26
  function P(r, t, a) {
27
- return (n) => {
27
+ return (o) => {
28
28
  const { start: c = 0, scale: e = 1 } = r.value;
29
29
  if (typeof a == "number")
30
- return Math.ceil(n / (a * e));
31
- let o = 0, l = 0;
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 (o += s, l = u, o > n)
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 W(r, t, a) {
41
- return (n) => {
41
+ return (o) => {
42
42
  const { scale: c = 1 } = a.value;
43
43
  if (typeof t == "number")
44
- return Math.floor(n / (t * c)) + 1;
45
- let e = 0, o = 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 >= n) {
49
- o = l;
48
+ if (e += u, e >= o) {
49
+ n = l;
50
50
  break;
51
51
  }
52
52
  }
53
- return o + 1;
53
+ return n + 1;
54
54
  };
55
55
  }
56
- function k(r, t, a, n, { containerRef: c, state: e, currentList: o, source: l }, u) {
56
+ function k(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 = n(r === "vertical" ? s.clientHeight : s.clientWidth), p = f - t, g = f + i + t;
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
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
- }, o.value = l.value.slice(e.value.start, e.value.end).map((h, v) => ({
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,33 +71,33 @@ function k(r, t, a, n, { containerRef: c, state: e, currentList: o, source: l },
71
71
  };
72
72
  }
73
73
  function D(r, t, a) {
74
- return (n) => {
74
+ return (o) => {
75
75
  const { scale: c = 1 } = a.value;
76
- return typeof r == "number" ? n * (r * c) : t.value.slice(0, n).reduce((o, l, u) => o + r(u) * c, 0);
76
+ return typeof r == "number" ? o * (r * c) : t.value.slice(0, o).reduce((n, l, u) => n + r(u) * c, 0);
77
77
  };
78
78
  }
79
- function E(r, t, a, n) {
79
+ function E(r, t, a, o) {
80
80
  M([r.width, r.height, t, a], () => {
81
- n();
81
+ o();
82
82
  });
83
83
  }
84
84
  function G(r, t, a) {
85
85
  return y(() => {
86
- const { scale: n = 1 } = a.value;
87
- return typeof r == "number" ? t.value.length * r * n : t.value.reduce((c, e, o) => c + r(o) * n, 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);
88
88
  });
89
89
  }
90
- const K = {
90
+ const S = {
91
91
  horizontal: "scrollLeft",
92
92
  vertical: "scrollTop"
93
93
  };
94
- function U(r, t, a, n) {
94
+ function U(r, t, a, o) {
95
95
  return (c) => {
96
- n.value && (n.value[K[r]] = a(c), t());
96
+ o.value && (o.value[S[r]] = a(c), t());
97
97
  };
98
98
  }
99
- function S(r, t) {
100
- const { on: a, trigger: n } = $(), c = O(t), { state: e, source: o, currentList: l, size: u, containerRef: s } = c, f = { overflowX: "auto" }, { itemWidth: i, overscan: p = 5 } = r, g = P(e, o, i), h = W(o, i, e), v = k("horizontal", p, h, g, c, n), m = D(i, o, e), d = y(() => m(e.value.start)), R = G(i, o, e);
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
101
  E(u, t, s, v);
102
102
  const V = U("horizontal", v, m, s), b = (T) => {
103
103
  e.value.scale = T;
@@ -126,20 +126,20 @@ function S(r, t) {
126
126
  };
127
127
  }
128
128
  function Y(r, t) {
129
- const { on: a, trigger: n } = $(), c = O(t), { state: e, source: o, currentList: l, size: u, containerRef: s } = c, f = { overflowY: "auto" }, { itemHeight: i, overscan: p = 5 } = r, g = P(e, o, i), h = W(o, i, e), v = k("vertical", p, h, g, c, n), m = D(i, o, e), d = y(() => m(e.value.start)), R = G(i, o, e);
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
130
  E(u, t, s, v);
131
131
  const V = U("vertical", v, m, s), b = (T) => {
132
132
  const w = s.value;
133
133
  if (w) {
134
134
  const { current: C } = e.value;
135
135
  let L = 0;
136
- typeof i == "number" ? L = C * (T * i - e.value.scale * i) : L = o.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;
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;
137
137
  }
138
138
  }, x = y(() => ({
139
139
  style: {
140
140
  height: `${R.value - d.value}px`,
141
141
  marginTop: `${d.value}px`,
142
- transform: `translateX(-50%) scale(${e.value.scale})`,
142
+ transform: `scale(${e.value.scale})`,
143
143
  transformOrigin: "50% 0%"
144
144
  }
145
145
  }));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../../../../../node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.4.38/node_modules/@vueuse/shared/index.js"),f=require("vue-demi"),M=require("@vueuse/core");function S(r,t){const{containerStyle:a,wrapperProps:n,scrollTo:c,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:c,containerProps:{ref:l,onScroll:()=>{e()},style:a},wrapperProps:n}}function O(r){const t=f.ref(null),a=M.useElementSize(t),n=f.ref([]),c=f.shallowRef(r);return{state:f.ref({start:0,end:10,current:0,scale:1}),source:c,currentList:n,size:a,containerRef:t}}function $(r,t,a){return n=>{const{start:c=0,scale:e=1}=r.value;if(typeof a=="number")return Math.ceil(n/(a*e));let o=0,l=0;for(let u=c;u<t.value.length;u++){const s=a(u)*e;if(o+=s,l=u,o>n)break}return l-c}}function P(r,t,a){return n=>{const{scale:c=1}=a.value;if(typeof t=="number")return Math.floor(n/(t*c))+1;let e=0,o=0;for(let l=0;l<r.value.length;l++){const u=t(l)*c;if(e+=u,e>=n){o=l;break}}return o+1}}function k(r,t,a,n,{containerRef:c,state:e,currentList:o,source:l},u){return()=>{const s=c.value;if(s){const v=a(r==="vertical"?s.scrollTop:s.scrollLeft),i=n(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 D(r,t,a){return n=>{const{scale:c=1}=a.value;return typeof r=="number"?n*(r*c):t.value.slice(0,n).reduce((o,l,u)=>o+r(u)*c,0)}}function E(r,t,a,n){f.watch([r.width,r.height,t,a],()=>{n()})}function W(r,t,a){return f.computed(()=>{const{scale:n=1}=a.value;return typeof r=="number"?t.value.length*r*n:t.value.reduce((c,e,o)=>c+r(o)*n,0)})}const U={horizontal:"scrollLeft",vertical:"scrollTop"};function q(r,t,a,n){return c=>{n.value&&(n.value[U[r]]=a(c),t())}}function _(r,t){const{on:a,trigger:n}=C.createEventHook(),c=O(t),{state:e,source:o,currentList:l,size:u,containerRef:s}=c,v={overflowX:"auto"},{itemWidth:i,overscan:g=5}=r,h=$(e,o,i),d=P(o,i,e),p=k("horizontal",g,d,h,c,n),m=D(i,o,e),y=f.computed(()=>m(e.value.start)),b=W(i,o,e);E(u,t,s,p);const R=q("horizontal",p,m,s),V=T=>{e.value.scale=T},H=f.computed(()=>({style:{height:"100%",width:`${b.value-y.value}px`,marginLeft:`${y.value}px`,display:"flex",transform:`scale(${e.value.scale})`,transformOrigin:"50% 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:n}=C.createEventHook(),c=O(t),{state:e,source:o,currentList:l,size:u,containerRef:s}=c,v={overflowY:"auto"},{itemHeight:i,overscan:g=5}=r,h=$(e,o,i),d=P(o,i,e),p=k("vertical",g,d,h,c,n),m=D(i,o,e),y=f.computed(()=>m(e.value.start)),b=W(i,o,e);E(u,t,s,p);const R=q("vertical",p,m,s),V=T=>{const L=s.value;if(L){const{current:x}=e.value;let w=0;typeof i=="number"?w=x*(T*i-e.value.scale*i):w=o.value.slice(0,x).reduce((G,X,z)=>G+T*i(z)-e.value.scale*i(z),0),L.scrollTop=L.scrollTop+w>=0?L.scrollTop+w:0,e.value.scale=T}},H=f.computed(()=>({style:{height:`${b.value-y.value}px`,marginTop:`${y.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("../../../../../node_modules/.pnpm/@vueuse_shared@10.11.1_vue@3.4.38/node_modules/@vueuse/shared/index.js"),f=require("vue-demi"),M=require("@vueuse/core");function S(r,t){const{containerStyle:a,wrapperProps:o,scrollTo:c,calculateRange:e,currentList:n,containerRef:l,scaleTo:u,state:s,onUpdate:v}="itemHeight"in t?F(t,r):_(t,r);return{onUpdate:v,state:s,scaleTo:u,list:n,scrollTo:c,containerProps:{ref:l,onScroll:()=>{e()},style:a},wrapperProps:o}}function O(r){const t=f.ref(null),a=M.useElementSize(t),o=f.ref([]),c=f.shallowRef(r);return{state:f.ref({start:0,end:10,current:0,scale:1}),source:c,currentList:o,size:a,containerRef:t}}function $(r,t,a){return o=>{const{start:c=0,scale:e=1}=r.value;if(typeof a=="number")return Math.ceil(o/(a*e));let n=0,l=0;for(let u=c;u<t.value.length;u++){const s=a(u)*e;if(n+=s,l=u,n>o)break}return l-c}}function P(r,t,a){return o=>{const{scale:c=1}=a.value;if(typeof t=="number")return Math.floor(o/(t*c))+1;let e=0,n=0;for(let l=0;l<r.value.length;l++){const u=t(l)*c;if(e+=u,e>=o){n=l;break}}return n+1}}function k(r,t,a,o,{containerRef:c,state:e,currentList:n,source:l},u){return()=>{const s=c.value;if(s){const v=a(r==="vertical"?s.scrollTop:s.scrollLeft),i=o(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},n.value=l.value.slice(e.value.start,e.value.end).map((d,p)=>({data:d,index:p+e.value.start})),u(e.value)}}}function D(r,t,a){return o=>{const{scale:c=1}=a.value;return typeof r=="number"?o*(r*c):t.value.slice(0,o).reduce((n,l,u)=>n+r(u)*c,0)}}function E(r,t,a,o){f.watch([r.width,r.height,t,a],()=>{o()})}function W(r,t,a){return f.computed(()=>{const{scale:o=1}=a.value;return typeof r=="number"?t.value.length*r*o:t.value.reduce((c,e,n)=>c+r(n)*o,0)})}const U={horizontal:"scrollLeft",vertical:"scrollTop"};function q(r,t,a,o){return c=>{o.value&&(o.value[U[r]]=a(c),t())}}function _(r,t){const{on:a,trigger:o}=C.createEventHook(),c=O(t),{state:e,source:n,currentList:l,size:u,containerRef:s}=c,v={overflowX:"auto"},{itemWidth:i,overscan:g=5}=r,h=$(e,n,i),d=P(n,i,e),p=k("horizontal",g,d,h,c,o),m=D(i,n,e),y=f.computed(()=>m(e.value.start)),b=W(i,n,e);E(u,t,s,p);const R=q("horizontal",p,m,s),V=T=>{e.value.scale=T},H=f.computed(()=>({style:{height:"100%",width:`${b.value-y.value}px`,marginLeft:`${y.value}px`,display:"flex",transform:`scale(${e.value.scale})`,transformOrigin:"50% 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:o}=C.createEventHook(),c=O(t),{state:e,source:n,currentList:l,size:u,containerRef:s}=c,v={overflowY:"auto"},{itemHeight:i,overscan:g=5}=r,h=$(e,n,i),d=P(n,i,e),p=k("vertical",g,d,h,c,o),m=D(i,n,e),y=f.computed(()=>m(e.value.start)),b=W(i,n,e);E(u,t,s,p);const R=q("vertical",p,m,s),V=T=>{const L=s.value;if(L){const{current:x}=e.value;let w=0;typeof i=="number"?w=x*(T*i-e.value.scale*i):w=n.value.slice(0,x).reduce((G,j,z)=>G+T*i(z)-e.value.scale*i(z),0),L.scrollTop=L.scrollTop+w>=0?L.scrollTop+w:0,e.value.scale=T}},H=f.computed(()=>({style:{height:`${b.value-y.value}px`,marginTop:`${y.value}px`,transform:`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;
@@ -1 +1 @@
1
- :root{--king-color-white:#ffffff;--king-color-primary:#409eff;--king-color-success:#67c23a;--king-color-warning:#e6a23c;--king-color-danger:#f56c6c;--king-color-error:#f56c6c;--king-color-info:#909399;--king-transition-duration:0.3s}.king-button--primary{--king-button-text-color:var(--king-color-primary)}.king-button--success{--king-button-text-color:var(--king-color-success)}.king-button--warning{--king-button-text-color:var(--king-color-warning)}.king-button--danger{--king-button-text-color:var(--king-color-danger)}.king-button--error{--king-button-text-color:var(--king-color-error)}.king-button--info{--king-button-text-color:var(--king-color-info)}.king-button{color:var(--king-button-text-color)}.king-scrollbar{overflow:hidden;position:relative;z-index:auto;height:100%;width:100%}.king-scrollbar .king-scrollbar-container{width:100%;overflow:scroll;height:100%;min-height:inherit;max-height:inherit;scrollbar-width:none}.king-scrollbar .king-scrollbar-content{width:-moz-fit-content;width:fit-content}.king-scrollbar .king-scrollbar-rail{position:absolute}.king-scrollbar .king-scrollbar-rail--vertical{right:0;width:5px;top:2px;bottom:2px;right:4px}.king-scrollbar .king-scrollbar-rail--horizontal{bottom:2px;height:5px;left:2px;right:2px}.king-scrollbar .king-scrollbar-rail__scrollbar--vertical{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;width:100%;cursor:pointer}.king-scrollbar .king-scrollbar-rail__scrollbar--horizontal{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;height:100%;cursor:pointer}.v-vl-items{width:-moz-fit-content;width:fit-content}.king-scale-virtual-list{width:100%;height:100%}.king-scale-virtual-list .king-scale-virtual-list-container{position:relative;margin:0 auto}.king-scale-virtual-list .king-scale-vittual-wrapper{position:absolute;left:50%}
1
+ :root{--king-color-white:#ffffff;--king-color-primary:#409eff;--king-color-success:#67c23a;--king-color-warning:#e6a23c;--king-color-danger:#f56c6c;--king-color-error:#f56c6c;--king-color-info:#909399;--king-transition-duration:0.3s}.king-button--primary{--king-button-text-color:var(--king-color-primary)}.king-button--success{--king-button-text-color:var(--king-color-success)}.king-button--warning{--king-button-text-color:var(--king-color-warning)}.king-button--danger{--king-button-text-color:var(--king-color-danger)}.king-button--error{--king-button-text-color:var(--king-color-error)}.king-button--info{--king-button-text-color:var(--king-color-info)}.king-button{color:var(--king-button-text-color)}.king-scrollbar{overflow:hidden;position:relative;z-index:auto;height:100%;width:100%}.king-scrollbar .king-scrollbar-container{width:100%;overflow:scroll;height:100%;min-height:inherit;max-height:inherit;scrollbar-width:none}.king-scrollbar .king-scrollbar-content{width:-moz-fit-content;width:fit-content}.king-scrollbar .king-scrollbar-rail{position:absolute}.king-scrollbar .king-scrollbar-rail--vertical{right:0;width:5px;top:2px;bottom:2px;right:4px}.king-scrollbar .king-scrollbar-rail--horizontal{bottom:2px;height:5px;left:2px;right:2px}.king-scrollbar .king-scrollbar-rail__scrollbar--vertical{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;width:100%;cursor:pointer}.king-scrollbar .king-scrollbar-rail__scrollbar--horizontal{background:rgba(0,0,0,.25);position:absolute;border-radius:5px;height:100%;cursor:pointer}.v-vl-items{width:-moz-fit-content;width:fit-content}.king-scale-virtual-list{width:100%;height:100%}.king-scale-virtual-list .king-scale-vittual-wrapper{width:-moz-fit-content;width:fit-content;margin:0 auto}
@@ -1 +1 @@
1
- .king-scale-virtual-list{width:100%;height:100%}.king-scale-virtual-list .king-scale-virtual-list-container{position:relative;margin:0 auto}.king-scale-virtual-list .king-scale-vittual-wrapper{position:absolute;left:50%}
1
+ .king-scale-virtual-list{width:100%;height:100%}.king-scale-virtual-list .king-scale-vittual-wrapper{width:-moz-fit-content;width:fit-content;margin:0 auto}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@king-one/antdv",
3
3
  "type": "module",
4
- "version": "1.0.27",
4
+ "version": "1.0.28",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",