@king-one/antdv 1.0.74 → 1.0.75
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,13 +1,13 @@
|
|
|
1
1
|
import { createEventHook as O } from "@vueuse/shared";
|
|
2
|
-
import { ref as
|
|
2
|
+
import { ref as H, shallowRef as _, watch as F, computed as y } from "vue";
|
|
3
3
|
import { useElementSize as X } from "@vueuse/core";
|
|
4
4
|
function I(r, t) {
|
|
5
|
-
const { containerStyle: a, wrapperProps:
|
|
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);
|
|
6
6
|
return {
|
|
7
7
|
onUpdate: f,
|
|
8
8
|
state: s,
|
|
9
9
|
scaleTo: u,
|
|
10
|
-
list:
|
|
10
|
+
list: o,
|
|
11
11
|
scrollTo: c,
|
|
12
12
|
containerProps: {
|
|
13
13
|
ref: l,
|
|
@@ -16,56 +16,54 @@ function I(r, t) {
|
|
|
16
16
|
},
|
|
17
17
|
style: a
|
|
18
18
|
},
|
|
19
|
-
wrapperProps:
|
|
19
|
+
wrapperProps: n
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
function z(r) {
|
|
23
|
-
const t =
|
|
24
|
-
return { state:
|
|
23
|
+
const t = H(null), a = X(t), n = H([]), c = _(r);
|
|
24
|
+
return { state: H({ start: 0, end: 10, current: 0, scale: 1 }), source: c, currentList: n, size: a, containerRef: t };
|
|
25
25
|
}
|
|
26
26
|
function M(r, t, a) {
|
|
27
|
-
return (
|
|
27
|
+
return (n) => {
|
|
28
28
|
const { start: c = 0, scale: e = 1 } = r.value;
|
|
29
29
|
if (typeof a == "number")
|
|
30
|
-
return Math.ceil(
|
|
31
|
-
let
|
|
30
|
+
return Math.ceil(n / (a * e));
|
|
31
|
+
let o = 0, l = 0;
|
|
32
32
|
for (let u = c; u < t.value.length; u++) {
|
|
33
33
|
const s = a(u) * e;
|
|
34
|
-
if (
|
|
34
|
+
if (o += s, l = u, o > n)
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
return l - c;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
function P(r, t, a) {
|
|
41
|
-
return (
|
|
41
|
+
return (n) => {
|
|
42
42
|
const { scale: c = 1 } = a.value;
|
|
43
43
|
if (typeof t == "number")
|
|
44
|
-
return Math.floor(
|
|
45
|
-
let e = 0,
|
|
44
|
+
return Math.floor(n / (t * c)) + 1;
|
|
45
|
+
let e = 0, o = 0;
|
|
46
46
|
for (let l = 0; l < r.value.length; l++) {
|
|
47
47
|
const u = t(l) * c;
|
|
48
|
-
if (e += u, e >
|
|
49
|
-
|
|
48
|
+
if (e += u, e > n) {
|
|
49
|
+
o = l;
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
return
|
|
53
|
+
return o + 1;
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function W(r, t, a,
|
|
56
|
+
function W(r, t, a, n, { containerRef: c, state: e, currentList: o, 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);
|
|
61
|
-
console.log("offset", f);
|
|
62
|
-
const i = o(r === "vertical" ? s.clientHeight : s.clientWidth), p = f - t, g = f + i + t;
|
|
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;
|
|
63
61
|
e.value = {
|
|
64
62
|
start: p < 0 ? 0 : p,
|
|
65
63
|
end: g > l.value.length ? l.value.length : g,
|
|
66
64
|
current: f - 1,
|
|
67
65
|
scale: e.value.scale
|
|
68
|
-
},
|
|
66
|
+
}, o.value = l.value.slice(e.value.start, e.value.end).map((h, v) => ({
|
|
69
67
|
data: h,
|
|
70
68
|
index: v + e.value.start
|
|
71
69
|
})), u(e.value);
|
|
@@ -73,42 +71,46 @@ function W(r, t, a, o, { containerRef: c, state: e, currentList: n, source: l },
|
|
|
73
71
|
};
|
|
74
72
|
}
|
|
75
73
|
function k(r, t, a) {
|
|
76
|
-
return (
|
|
74
|
+
return (n) => {
|
|
77
75
|
const { scale: c = 1 } = a.value;
|
|
78
76
|
if (typeof r == "number") {
|
|
79
|
-
const
|
|
80
|
-
return Math.ceil(
|
|
77
|
+
const o = n * (r * c);
|
|
78
|
+
return Math.ceil(o);
|
|
81
79
|
}
|
|
82
|
-
const e = t.value.slice(0,
|
|
80
|
+
const e = t.value.slice(0, n).reduce((o, l, u) => o + r(u) * c, 0);
|
|
83
81
|
return Math.ceil(e);
|
|
84
82
|
};
|
|
85
83
|
}
|
|
86
|
-
function D(r, t, a,
|
|
84
|
+
function D(r, t, a, n) {
|
|
87
85
|
F([r.width, r.height, t, a], () => {
|
|
88
|
-
|
|
86
|
+
n();
|
|
89
87
|
});
|
|
90
88
|
}
|
|
91
89
|
function E(r, t, a) {
|
|
92
90
|
return y(() => {
|
|
93
|
-
const { scale:
|
|
94
|
-
return typeof r == "number" ? t.value.length * r *
|
|
91
|
+
const { scale: n = 1 } = a.value;
|
|
92
|
+
return typeof r == "number" ? t.value.length * r * n : t.value.reduce((c, e, o) => c + r(o) * n, 0);
|
|
95
93
|
});
|
|
96
94
|
}
|
|
97
95
|
const K = {
|
|
98
96
|
horizontal: "scrollLeft",
|
|
99
97
|
vertical: "scrollTop"
|
|
100
98
|
};
|
|
101
|
-
function G(r, t, a,
|
|
99
|
+
function G(r, t, a, n) {
|
|
102
100
|
return (c) => {
|
|
103
|
-
|
|
101
|
+
if (n.value) {
|
|
102
|
+
if (c < 0)
|
|
103
|
+
return;
|
|
104
|
+
n.value[K[r]] = a(c), t();
|
|
105
|
+
}
|
|
104
106
|
};
|
|
105
107
|
}
|
|
106
108
|
function S(r, t) {
|
|
107
|
-
const { on: a, trigger:
|
|
109
|
+
const { on: a, trigger: n } = O(), c = z(t), { state: e, source: o, currentList: l, size: u, containerRef: s } = c, f = { overflowX: "auto" }, { itemWidth: i, overscan: p = 5 } = r, g = M(e, o, i), h = P(o, i, e), v = W("horizontal", p, h, g, c, n), m = k(i, o, e), d = y(() => m(e.value.start)), R = E(i, o, e);
|
|
108
110
|
D(u, t, s, v);
|
|
109
111
|
const V = G("horizontal", v, m, s), b = (T) => {
|
|
110
112
|
e.value.scale = T;
|
|
111
|
-
},
|
|
113
|
+
}, C = y(() => ({
|
|
112
114
|
style: {
|
|
113
115
|
height: "100%",
|
|
114
116
|
width: `${R.value - d.value}px`,
|
|
@@ -126,23 +128,23 @@ function S(r, t) {
|
|
|
126
128
|
scaleTo: b,
|
|
127
129
|
scrollTo: V,
|
|
128
130
|
calculateRange: v,
|
|
129
|
-
wrapperProps:
|
|
131
|
+
wrapperProps: C,
|
|
130
132
|
containerStyle: f,
|
|
131
133
|
currentList: l,
|
|
132
134
|
containerRef: s
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
137
|
function Y(r, t) {
|
|
136
|
-
const { on: a, trigger:
|
|
138
|
+
const { on: a, trigger: n } = O(), c = z(t), { state: e, source: o, currentList: l, size: u, containerRef: s } = c, f = { overflowY: "auto" }, { itemHeight: i, overscan: p = 5 } = r, g = M(e, o, i), h = P(o, i, e), v = W("vertical", p, h, g, c, n), m = k(i, o, e), d = y(() => m(e.value.start)), R = E(i, o, e);
|
|
137
139
|
D(u, t, s, v);
|
|
138
140
|
const V = G("vertical", v, m, s), b = (T) => {
|
|
139
141
|
const w = s.value;
|
|
140
142
|
if (w) {
|
|
141
|
-
const { current:
|
|
143
|
+
const { current: $ } = e.value;
|
|
142
144
|
let L = 0;
|
|
143
|
-
typeof i == "number" ? L =
|
|
145
|
+
typeof i == "number" ? L = $ * (T * i - e.value.scale * i) : L = o.value.slice(0, $).reduce((U, j, x) => U + T * i(x) - e.value.scale * i(x), 0), w.scrollTop = w.scrollTop + L >= 0 ? w.scrollTop + L : 0, e.value.scale = T;
|
|
144
146
|
}
|
|
145
|
-
},
|
|
147
|
+
}, C = y(() => ({
|
|
146
148
|
style: {
|
|
147
149
|
height: `${R.value - d.value}px`,
|
|
148
150
|
marginTop: `${d.value}px`,
|
|
@@ -157,7 +159,7 @@ function Y(r, t) {
|
|
|
157
159
|
calculateRange: v,
|
|
158
160
|
scrollTo: V,
|
|
159
161
|
containerStyle: f,
|
|
160
|
-
wrapperProps:
|
|
162
|
+
wrapperProps: C,
|
|
161
163
|
currentList: l,
|
|
162
164
|
containerRef: s
|
|
163
165
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("@vueuse/shared"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("@vueuse/shared"),f=require("vue"),G=require("@vueuse/core");function S(r,t){const{containerStyle:a,wrapperProps:o,scrollTo:n,calculateRange:e,currentList:c,containerRef:l,scaleTo:u,state:s,onUpdate:v}="itemHeight"in t?F(t,r):_(t,r);return{onUpdate:v,state:s,scaleTo:u,list:c,scrollTo:n,containerProps:{ref:l,onScroll:()=>{e()},style:a},wrapperProps:o}}function M(r){const t=f.ref(null),a=G.useElementSize(t),o=f.ref([]),n=f.shallowRef(r);return{state:f.ref({start:0,end:10,current:0,scale:1}),source:n,currentList:o,size:a,containerRef:t}}function P(r,t,a){return o=>{const{start:n=0,scale:e=1}=r.value;if(typeof a=="number")return Math.ceil(o/(a*e));let c=0,l=0;for(let u=n;u<t.value.length;u++){const s=a(u)*e;if(c+=s,l=u,c>o)break}return l-n}}function k(r,t,a){return o=>{const{scale:n=1}=a.value;if(typeof t=="number")return Math.floor(o/(t*n))+1;let e=0,c=0;for(let l=0;l<r.value.length;l++){const u=t(l)*n;if(e+=u,e>o){c=l;break}}return c+1}}function x(r,t,a,o,{containerRef:n,state:e,currentList:c,source:l},u){return()=>{const s=n.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},c.value=l.value.slice(e.value.start,e.value.end).map((d,p)=>({data:d,index:p+e.value.start})),u(e.value)}}}function z(r,t,a){return o=>{const{scale:n=1}=a.value;if(typeof r=="number"){const c=o*(r*n);return Math.ceil(c)}const e=t.value.slice(0,o).reduce((c,l,u)=>c+r(u)*n,0);return Math.ceil(e)}}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((n,e,c)=>n+r(c)*o,0)})}const U={horizontal:"scrollLeft",vertical:"scrollTop"};function q(r,t,a,o){return n=>{if(o.value){if(n<0)return;o.value[U[r]]=a(n),t()}}}function _(r,t){const{on:a,trigger:o}=$.createEventHook(),n=M(t),{state:e,source:c,currentList:l,size:u,containerRef:s}=n,v={overflowX:"auto"},{itemWidth:i,overscan:g=5}=r,h=P(e,c,i),d=k(c,i,e),p=x("horizontal",g,d,h,n,o),m=z(i,c,e),y=f.computed(()=>m(e.value.start)),b=W(i,c,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:"0% 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}=$.createEventHook(),n=M(t),{state:e,source:c,currentList:l,size:u,containerRef:s}=n,v={overflowY:"auto"},{itemHeight:i,overscan:g=5}=r,h=P(e,c,i),d=k(c,i,e),p=x("vertical",g,d,h,n,o),m=z(i,c,e),y=f.computed(()=>m(e.value.start)),b=W(i,c,e);E(u,t,s,p);const R=q("vertical",p,m,s),V=T=>{const L=s.value;if(L){const{current:C}=e.value;let w=0;typeof i=="number"?w=C*(T*i-e.value.scale*i):w=c.value.slice(0,C).reduce((D,X,O)=>D+T*i(O)-e.value.scale*i(O),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 +1 @@
|
|
|
1
|
-
@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=
|
|
1
|
+
@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=21102) format("woff2"),url(fonts/iconfont.woff?t=3852) format("woff"),url(fonts/iconfont.ttf?t=79220) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-title-icon:before{content:"\e680"}
|
|
@@ -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{margin:0 auto;position:relative}.king-scale-virtual-list .king-scale-vittual-wrapper{width:-moz-fit-content;width:fit-content;margin:0 auto;position:absolute;left:50%}.king-pro-title{border-bottom:1px solid #ccc;font-weight:500;display:flex;align-items:center}.king-pro-title .icon{margin-right:10px}.king-pro-title--unborder{border:none}.king-pro-modal .ant-modal-content{padding:0}.king-pro-modal .ant-modal-header{height:56px;padding-left:32px;padding-right:24px;display:flex;justify-content:space-between;align-items:center;background:#f1f7ff;border-bottom:1px solid #e6e8ea}.king-pro-modal .ant-modal-body{padding:10px 20px;max-height:65vh;overflow:auto}.king-pro-modal .ant-modal-footer{height:56px;display:flex;padding:0 16px;justify-content:flex-end;align-items:center;border-top:1px solid #e6e8ea}.king-pro-modal .ant-modal-title{flex:1}.king-pro-modal .pro-modal-title{cursor:move;width:100%}.king-pro-area-select{width:100%}@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=
|
|
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{margin:0 auto;position:relative}.king-scale-virtual-list .king-scale-vittual-wrapper{width:-moz-fit-content;width:fit-content;margin:0 auto;position:absolute;left:50%}.king-pro-title{border-bottom:1px solid #ccc;font-weight:500;display:flex;align-items:center}.king-pro-title .icon{margin-right:10px}.king-pro-title--unborder{border:none}.king-pro-modal .ant-modal-content{padding:0}.king-pro-modal .ant-modal-header{height:56px;padding-left:32px;padding-right:24px;display:flex;justify-content:space-between;align-items:center;background:#f1f7ff;border-bottom:1px solid #e6e8ea}.king-pro-modal .ant-modal-body{padding:10px 20px;max-height:65vh;overflow:auto}.king-pro-modal .ant-modal-footer{height:56px;display:flex;padding:0 16px;justify-content:flex-end;align-items:center;border-top:1px solid #e6e8ea}.king-pro-modal .ant-modal-title{flex:1}.king-pro-modal .pro-modal-title{cursor:move;width:100%}.king-pro-area-select{width:100%}@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=28320) format("woff2"),url(fonts/iconfont.woff?t=47468) format("woff"),url(fonts/iconfont.ttf?t=18139) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-title-icon:before{content:"\e680"}
|