@king-one/antdv 1.0.28 → 1.0.29
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
|
@@ -61,7 +61,7 @@ function k(r, t, a, o, { containerRef: c, state: e, currentList: n, source: l },
|
|
|
61
61
|
e.value = {
|
|
62
62
|
start: p < 0 ? 0 : p,
|
|
63
63
|
end: g > l.value.length ? l.value.length : g,
|
|
64
|
-
current: f
|
|
64
|
+
current: f,
|
|
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,
|
|
@@ -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: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
|
+
"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,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;
|