geekin-devtoys 0.1.4 → 0.1.6
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/lib/GBubble/index.js +2 -0
- package/lib/GBubble/index.mjs +235 -0
- package/lib/GBubble/style.css +1 -0
- package/lib/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +16 -16
- package/lib/GDialog/style.css +1 -1
- package/lib/GPercent/index.js +1 -1
- package/lib/GPercent/index.mjs +85 -60
- package/lib/GPercent/style.css +1 -1
- package/lib/GPluginVideo/index.js +5 -5
- package/lib/GPluginVideo/index.mjs +71 -68
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +1475 -72
- package/lib/GTable/style.css +1 -1
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +14 -12
- package/lib/{index-BOura9rV.js → index-B86xv9Xx.js} +1 -1
- package/lib/{index-BPwO5l8J.mjs → index-DSzb017c.mjs} +35 -20
- package/package.json +12 -5
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("vue"),J=require("../_plugin-vue_export-helper-BHFhmbuH.js"),K={__name:"index",props:{data:{type:Array,default:()=>[]},config:{type:Object,default:()=>({minRadius:25,maxRadius:100,padding:10,colors:["#1E88E5","#26A69A","#4CAF50","#F57C00","#9C27B0","#FF5722","#607D8B"],textColor:"#FFFFFF"})},animation:{type:Boolean,default:!0}},setup(j){const X=j,S=f.ref(null),A=f.ref(null);let x=null,m=0,y=0;const C={...X.config},P=f.ref(!1),z=f.ref(0),H=f.ref(0),V=f.ref(null);let L=f.ref(-1),l=[];const $=()=>{if(!A.value||!S.value)return;const t=S.value,o=A.value;t.style.width="100%",t.style.height="100%",m=t.clientWidth,y=t.clientHeight,o.width=m,o.height=y,o.style.width=m+"px",o.style.height=y+"px",x=o.getContext("2d"),T(),G()},T=()=>{l=[];const t=X.data,o=t.map(u=>u.value),s=Math.max(...o),r=Math.min(...o),d=s-r;t.forEach((u,e)=>{const M=d>0?(u.value-r)/d:.5,n=C.minRadius+(C.maxRadius-C.minRadius)*M,g=e/t.length*Math.PI*2,R=m/2,i=y/2,a=Math.min(m,y)/3;let c=R+Math.cos(g)*a,h=i+Math.sin(g)*a;c=Math.max(n,Math.min(m-n,c)),h=Math.max(n,Math.min(y-n,h)),l.push({x:c,y:h,radius:n,data:u,color:C.colors[e%C.colors.length],vx:(Math.random()-.5)*.2,vy:(Math.random()-.5)*.2})});const p=1500,F=.2,B=.9;for(let u=0;u<p;u++){const e=l.map(()=>({x:0,y:0}));for(let i=0;i<l.length;i++){const a=l[i];for(let c=i+1;c<l.length;c++){const h=l[c],v=a.x-h.x,Y=a.y-h.y,_=Math.sqrt(v*v+Y*Y),I=a.radius+h.radius+C.padding;if(_<I){const q=(I-_)*F,E=v/_*q,w=Y/_*q;e[i].x+=E,e[i].y+=w,e[c].x-=E,e[c].y-=w}else if(_>0){const q=1/_*F*5,E=v/_*q,w=Y/_*q;e[i].x+=E,e[i].y+=w,e[c].x-=E,e[c].y-=w}}}const M=m/2,n=y/2,g=.01;for(let i=0;i<l.length;i++){const a=l[i],c=M-a.x,h=n-a.y,v=Math.sqrt(c*c+h*h);if(v>0){const Y=v*g,_=c/v*Y,I=h/v*Y;e[i].x+=_,e[i].y+=I}}let R=0;for(let i=0;i<l.length;i++){const a=l[i],c=e[i],h=c.x*B,v=c.y*B,Y=Math.sqrt(h*h+v*v);R+=Y,a.x+=h,a.y+=v,a.x=Math.max(a.radius,Math.min(m-a.radius,a.x)),a.y=Math.max(a.radius,Math.min(y-a.radius,a.y))}if(R<.1)break}for(let u=0;u<l.length;u++){const e=l[u];for(let M=u+1;M<l.length;M++){const n=l[M],g=e.x-n.x,R=e.y-n.y,i=Math.sqrt(g*g+R*R),a=e.radius+n.radius+C.padding;if(i<a){const c=Math.atan2(R,g),h=(a-i)/2;e.x+=Math.cos(c)*h,e.y+=Math.sin(c)*h,n.x-=Math.cos(c)*h,n.y-=Math.sin(c)*h,e.x=Math.max(e.radius,Math.min(m-e.radius,e.x)),e.y=Math.max(e.radius,Math.min(y-e.radius,e.y)),n.x=Math.max(n.radius,Math.min(m-n.radius,n.x)),n.y=Math.max(n.radius,Math.min(y-n.radius,n.y))}}}};let D=null;const G=()=>{x&&(x.clearRect(0,0,m,y),X.animation&&N(),l.forEach((t,o)=>{const{x:s,y:r,radius:d,color:p,data:F}=t;x.beginPath(),x.arc(s,r,d,0,Math.PI*2);const B=x.createRadialGradient(s-d*.3,r-d*.3,0,s,r,d);B.addColorStop(0,p),B.addColorStop(1,p+"40"),x.fillStyle=B,x.fill();const u=m*.2,e=y*.2,M=u-s,n=e-r,g=Math.sqrt(M*M+n*n),R=s+M/g*d*.6,i=r+n/g*d*.6;x.beginPath(),x.arc(R,i,d*.3,0,Math.PI*2),x.fillStyle="rgba(255, 255, 255, 0.1)",x.fill(),x.fillStyle=C.textColor,x.textAlign="center",x.textBaseline="middle";const a=Math.max(10,d/2.5);x.font=`${a}px Arial`;const c=F.name.split(`
|
|
2
|
+
`);c.forEach((h,v)=>{const Y=r-(c.length-1)*a/2+v*a;x.fillText(h,s,Y)})}),X.animation&&(D=requestAnimationFrame(G)))},N=()=>{l.forEach(t=>{if(t.x+=t.vx,t.y+=t.vy,t.x-t.radius<0&&(t.x=t.radius,t.vx=-t.vx*.8),t.x+t.radius>m&&(t.x=m-t.radius,t.vx=-t.vx*.8),t.y-t.radius<0&&(t.y=t.radius,t.vy=-t.vy*.8),t.y+t.radius>y&&(t.y=y-t.radius,t.vy=-t.vy*.8),Math.random()<.01){t.vx+=(Math.random()-.5)*.1,t.vy+=(Math.random()-.5)*.1;const o=.3,s=Math.sqrt(t.vx*t.vx+t.vy*t.vy);s>o&&(t.vx=t.vx/s*o,t.vy=t.vy/s*o)}});for(let t=0;t<l.length;t++)for(let o=t+1;o<l.length;o++){const s=l[t],r=l[o],d=s.x-r.x,p=s.y-r.y,F=Math.sqrt(d*d+p*p),B=s.radius+r.radius;if(F<B){const u=Math.atan2(p,d),e=B-F,M=Math.cos(u)*e/2,n=Math.sin(u)*e/2;s.x+=M,s.y+=n,r.x-=M,r.y-=n;const g=s.vx,R=s.vy;s.vx=r.vx*.8,s.vy=r.vy*.8,r.vx=g*.8,r.vy=R*.8}}},O=t=>{if(!A.value)return;const o=A.value.getBoundingClientRect(),s=t.clientX-o.left,r=t.clientY-o.top;let d=-1;for(let p=0;p<l.length;p++){const F=l[p],B=s-F.x,u=r-F.y;if(Math.sqrt(B*B+u*u)<=F.radius){d=p;break}}d!==L.value?(L.value=d,d>=0?(P.value=!0,V.value=l[d].data,W(t)):(P.value=!1,V.value=null)):d>=0&&W(t)},W=t=>{if(S.value){const o=S.value.getBoundingClientRect(),s=120,r=60;z.value=Math.min(t.clientX+10-o.left,o.width-s),H.value=Math.min(t.clientY+10-o.top,o.height-r)}else z.value=t.clientX+10,H.value=t.clientY+10},U=()=>{P.value=!1,V.value=null,L.value=-1};return f.watch(()=>X.data,()=>{T(),G()},{deep:!0}),f.onMounted(()=>{$(),window.addEventListener("resize",$)}),f.onUnmounted(()=>{window.removeEventListener("resize",$),D&&(cancelAnimationFrame(D),D=null)}),(t,o)=>(f.openBlock(),f.createElementBlock("div",{class:"bubble-chart-container",ref_key:"containerRef",ref:S},[f.createElementVNode("canvas",{ref_key:"canvasRef",ref:A,onMousemove:O,onMouseleave:U},null,544),P.value?(f.openBlock(),f.createElementBlock("div",{key:0,class:"bubble-tooltip",style:f.normalizeStyle({left:`${z.value}px`,top:`${H.value}px`})},[f.renderSlot(t.$slots,"tooltip",{data:V.value},void 0,!0)],4)):f.createCommentVNode("",!0)],512))}},k=J._export_sfc(K,[["__scopeId","data-v-6eab8e5c"]]);k.install=j=>{j.component(k.name,k)};exports.GBubble=k;exports.default=k;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { ref as X, watch as Q, onMounted as Z, onUnmounted as b, createElementBlock as T, openBlock as O, createElementVNode as tt, createCommentVNode as nt, normalizeStyle as et, renderSlot as at } from "vue";
|
|
2
|
+
import { _ as ot } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
3
|
+
const st = {
|
|
4
|
+
__name: "index",
|
|
5
|
+
props: {
|
|
6
|
+
/**
|
|
7
|
+
* @description 要展示的数据项数组
|
|
8
|
+
* @version 0.1.6
|
|
9
|
+
* @default []
|
|
10
|
+
*/
|
|
11
|
+
data: {
|
|
12
|
+
type: Array,
|
|
13
|
+
default: () => []
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* @description 自定义气泡样式配置
|
|
17
|
+
* @version 0.1.6
|
|
18
|
+
* @default {}
|
|
19
|
+
*/
|
|
20
|
+
config: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: () => ({
|
|
23
|
+
minRadius: 25,
|
|
24
|
+
maxRadius: 100,
|
|
25
|
+
padding: 10,
|
|
26
|
+
colors: ["#1E88E5", "#26A69A", "#4CAF50", "#F57C00", "#9C27B0", "#FF5722", "#607D8B"],
|
|
27
|
+
textColor: "#FFFFFF"
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* @description 是否开启气泡图的动画效果
|
|
32
|
+
* @version 0.1.6
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
animation: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !0
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
setup(V) {
|
|
41
|
+
const A = V, _ = X(null), S = X(null);
|
|
42
|
+
let x = null, f = 0, m = 0;
|
|
43
|
+
const C = {
|
|
44
|
+
...A.config
|
|
45
|
+
}, k = X(!1), j = X(0), z = X(0), D = X(null);
|
|
46
|
+
let L = X(-1), l = [];
|
|
47
|
+
const $ = () => {
|
|
48
|
+
if (!S.value || !_.value) return;
|
|
49
|
+
const t = _.value, o = S.value;
|
|
50
|
+
t.style.width = "100%", t.style.height = "100%", f = t.clientWidth, m = t.clientHeight, o.width = f, o.height = m, o.style.width = f + "px", o.style.height = m + "px", x = o.getContext("2d"), G(), H();
|
|
51
|
+
}, G = () => {
|
|
52
|
+
l = [];
|
|
53
|
+
const t = A.data, o = t.map((u) => u.value), s = Math.max(...o), r = Math.min(...o), d = s - r;
|
|
54
|
+
t.forEach((u, n) => {
|
|
55
|
+
const y = d > 0 ? (u.value - r) / d : 0.5, e = C.minRadius + (C.maxRadius - C.minRadius) * y, p = n / t.length * Math.PI * 2, B = f / 2, i = m / 2, a = Math.min(f, m) / 3;
|
|
56
|
+
let c = B + Math.cos(p) * a, h = i + Math.sin(p) * a;
|
|
57
|
+
c = Math.max(e, Math.min(f - e, c)), h = Math.max(e, Math.min(m - e, h)), l.push({
|
|
58
|
+
x: c,
|
|
59
|
+
y: h,
|
|
60
|
+
radius: e,
|
|
61
|
+
data: u,
|
|
62
|
+
color: C.colors[n % C.colors.length],
|
|
63
|
+
// 随机初始速度(更缓慢移动)
|
|
64
|
+
vx: (Math.random() - 0.5) * 0.2,
|
|
65
|
+
vy: (Math.random() - 0.5) * 0.2
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
const M = 1500, R = 0.2, g = 0.9;
|
|
69
|
+
for (let u = 0; u < M; u++) {
|
|
70
|
+
const n = l.map(() => ({ x: 0, y: 0 }));
|
|
71
|
+
for (let i = 0; i < l.length; i++) {
|
|
72
|
+
const a = l[i];
|
|
73
|
+
for (let c = i + 1; c < l.length; c++) {
|
|
74
|
+
const h = l[c], v = a.x - h.x, F = a.y - h.y, Y = Math.sqrt(v * v + F * F), P = a.radius + h.radius + C.padding;
|
|
75
|
+
if (Y < P) {
|
|
76
|
+
const w = (P - Y) * R, E = v / Y * w, q = F / Y * w;
|
|
77
|
+
n[i].x += E, n[i].y += q, n[c].x -= E, n[c].y -= q;
|
|
78
|
+
} else if (Y > 0) {
|
|
79
|
+
const w = 1 / Y * R * 5, E = v / Y * w, q = F / Y * w;
|
|
80
|
+
n[i].x += E, n[i].y += q, n[c].x -= E, n[c].y -= q;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const y = f / 2, e = m / 2, p = 0.01;
|
|
85
|
+
for (let i = 0; i < l.length; i++) {
|
|
86
|
+
const a = l[i], c = y - a.x, h = e - a.y, v = Math.sqrt(c * c + h * h);
|
|
87
|
+
if (v > 0) {
|
|
88
|
+
const F = v * p, Y = c / v * F, P = h / v * F;
|
|
89
|
+
n[i].x += Y, n[i].y += P;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
let B = 0;
|
|
93
|
+
for (let i = 0; i < l.length; i++) {
|
|
94
|
+
const a = l[i], c = n[i], h = c.x * g, v = c.y * g, F = Math.sqrt(h * h + v * v);
|
|
95
|
+
B += F, a.x += h, a.y += v, a.x = Math.max(a.radius, Math.min(f - a.radius, a.x)), a.y = Math.max(a.radius, Math.min(m - a.radius, a.y));
|
|
96
|
+
}
|
|
97
|
+
if (B < 0.1)
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
for (let u = 0; u < l.length; u++) {
|
|
101
|
+
const n = l[u];
|
|
102
|
+
for (let y = u + 1; y < l.length; y++) {
|
|
103
|
+
const e = l[y], p = n.x - e.x, B = n.y - e.y, i = Math.sqrt(p * p + B * B), a = n.radius + e.radius + C.padding;
|
|
104
|
+
if (i < a) {
|
|
105
|
+
const c = Math.atan2(B, p), h = (a - i) / 2;
|
|
106
|
+
n.x += Math.cos(c) * h, n.y += Math.sin(c) * h, e.x -= Math.cos(c) * h, e.y -= Math.sin(c) * h, n.x = Math.max(
|
|
107
|
+
n.radius,
|
|
108
|
+
Math.min(f - n.radius, n.x)
|
|
109
|
+
), n.y = Math.max(
|
|
110
|
+
n.radius,
|
|
111
|
+
Math.min(m - n.radius, n.y)
|
|
112
|
+
), e.x = Math.max(
|
|
113
|
+
e.radius,
|
|
114
|
+
Math.min(f - e.radius, e.x)
|
|
115
|
+
), e.y = Math.max(
|
|
116
|
+
e.radius,
|
|
117
|
+
Math.min(m - e.radius, e.y)
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
let I = null;
|
|
124
|
+
const H = () => {
|
|
125
|
+
x && (x.clearRect(0, 0, f, m), A.animation && U(), l.forEach((t, o) => {
|
|
126
|
+
const { x: s, y: r, radius: d, color: M, data: R } = t;
|
|
127
|
+
x.beginPath(), x.arc(s, r, d, 0, Math.PI * 2);
|
|
128
|
+
const g = x.createRadialGradient(
|
|
129
|
+
s - d * 0.3,
|
|
130
|
+
r - d * 0.3,
|
|
131
|
+
0,
|
|
132
|
+
// 渐变中心(稍微偏移,增加立体感)
|
|
133
|
+
s,
|
|
134
|
+
r,
|
|
135
|
+
d
|
|
136
|
+
// 渐变边缘
|
|
137
|
+
);
|
|
138
|
+
g.addColorStop(0, M), g.addColorStop(1, M + "40"), x.fillStyle = g, x.fill();
|
|
139
|
+
const u = f * 0.2, n = m * 0.2, y = u - s, e = n - r, p = Math.sqrt(y * y + e * e), B = s + y / p * d * 0.6, i = r + e / p * d * 0.6;
|
|
140
|
+
x.beginPath(), x.arc(B, i, d * 0.3, 0, Math.PI * 2), x.fillStyle = "rgba(255, 255, 255, 0.1)", x.fill(), x.fillStyle = C.textColor, x.textAlign = "center", x.textBaseline = "middle";
|
|
141
|
+
const a = Math.max(10, d / 2.5);
|
|
142
|
+
x.font = `${a}px Arial`;
|
|
143
|
+
const c = R.name.split(`
|
|
144
|
+
`);
|
|
145
|
+
c.forEach((h, v) => {
|
|
146
|
+
const F = r - (c.length - 1) * a / 2 + v * a;
|
|
147
|
+
x.fillText(h, s, F);
|
|
148
|
+
});
|
|
149
|
+
}), A.animation && (I = requestAnimationFrame(H)));
|
|
150
|
+
}, U = () => {
|
|
151
|
+
l.forEach((t) => {
|
|
152
|
+
if (t.x += t.vx, t.y += t.vy, t.x - t.radius < 0 && (t.x = t.radius, t.vx = -t.vx * 0.8), t.x + t.radius > f && (t.x = f - t.radius, t.vx = -t.vx * 0.8), t.y - t.radius < 0 && (t.y = t.radius, t.vy = -t.vy * 0.8), t.y + t.radius > m && (t.y = m - t.radius, t.vy = -t.vy * 0.8), Math.random() < 0.01) {
|
|
153
|
+
t.vx += (Math.random() - 0.5) * 0.1, t.vy += (Math.random() - 0.5) * 0.1;
|
|
154
|
+
const o = 0.3, s = Math.sqrt(t.vx * t.vx + t.vy * t.vy);
|
|
155
|
+
s > o && (t.vx = t.vx / s * o, t.vy = t.vy / s * o);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
for (let t = 0; t < l.length; t++)
|
|
159
|
+
for (let o = t + 1; o < l.length; o++) {
|
|
160
|
+
const s = l[t], r = l[o], d = s.x - r.x, M = s.y - r.y, R = Math.sqrt(d * d + M * M), g = s.radius + r.radius;
|
|
161
|
+
if (R < g) {
|
|
162
|
+
const u = Math.atan2(M, d), n = g - R, y = Math.cos(u) * n / 2, e = Math.sin(u) * n / 2;
|
|
163
|
+
s.x += y, s.y += e, r.x -= y, r.y -= e;
|
|
164
|
+
const p = s.vx, B = s.vy;
|
|
165
|
+
s.vx = r.vx * 0.8, s.vy = r.vy * 0.8, r.vx = p * 0.8, r.vy = B * 0.8;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}, J = (t) => {
|
|
169
|
+
if (!S.value) return;
|
|
170
|
+
const o = S.value.getBoundingClientRect(), s = t.clientX - o.left, r = t.clientY - o.top;
|
|
171
|
+
let d = -1;
|
|
172
|
+
for (let M = 0; M < l.length; M++) {
|
|
173
|
+
const R = l[M], g = s - R.x, u = r - R.y;
|
|
174
|
+
if (Math.sqrt(g * g + u * u) <= R.radius) {
|
|
175
|
+
d = M;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
d !== L.value ? (L.value = d, d >= 0 ? (k.value = !0, D.value = l[d].data, N(t)) : (k.value = !1, D.value = null)) : d >= 0 && N(t);
|
|
180
|
+
}, N = (t) => {
|
|
181
|
+
if (_.value) {
|
|
182
|
+
const o = _.value.getBoundingClientRect(), s = 120, r = 60;
|
|
183
|
+
j.value = Math.min(
|
|
184
|
+
t.clientX + 10 - o.left,
|
|
185
|
+
o.width - s
|
|
186
|
+
), z.value = Math.min(
|
|
187
|
+
t.clientY + 10 - o.top,
|
|
188
|
+
o.height - r
|
|
189
|
+
);
|
|
190
|
+
} else
|
|
191
|
+
j.value = t.clientX + 10, z.value = t.clientY + 10;
|
|
192
|
+
}, K = () => {
|
|
193
|
+
k.value = !1, D.value = null, L.value = -1;
|
|
194
|
+
};
|
|
195
|
+
return Q(
|
|
196
|
+
() => A.data,
|
|
197
|
+
() => {
|
|
198
|
+
G(), H();
|
|
199
|
+
},
|
|
200
|
+
{ deep: !0 }
|
|
201
|
+
), Z(() => {
|
|
202
|
+
$(), window.addEventListener("resize", $);
|
|
203
|
+
}), b(() => {
|
|
204
|
+
window.removeEventListener("resize", $), I && (cancelAnimationFrame(I), I = null);
|
|
205
|
+
}), (t, o) => (O(), T("div", {
|
|
206
|
+
class: "bubble-chart-container",
|
|
207
|
+
ref_key: "containerRef",
|
|
208
|
+
ref: _
|
|
209
|
+
}, [
|
|
210
|
+
tt("canvas", {
|
|
211
|
+
ref_key: "canvasRef",
|
|
212
|
+
ref: S,
|
|
213
|
+
onMousemove: J,
|
|
214
|
+
onMouseleave: K
|
|
215
|
+
}, null, 544),
|
|
216
|
+
k.value ? (O(), T("div", {
|
|
217
|
+
key: 0,
|
|
218
|
+
class: "bubble-tooltip",
|
|
219
|
+
style: et({
|
|
220
|
+
left: `${j.value}px`,
|
|
221
|
+
top: `${z.value}px`
|
|
222
|
+
})
|
|
223
|
+
}, [
|
|
224
|
+
at(t.$slots, "tooltip", { data: D.value }, void 0, !0)
|
|
225
|
+
], 4)) : nt("", !0)
|
|
226
|
+
], 512));
|
|
227
|
+
}
|
|
228
|
+
}, W = /* @__PURE__ */ ot(st, [["__scopeId", "data-v-6eab8e5c"]]);
|
|
229
|
+
W.install = (V) => {
|
|
230
|
+
V.component(W.name, W);
|
|
231
|
+
};
|
|
232
|
+
export {
|
|
233
|
+
W as GBubble,
|
|
234
|
+
W as default
|
|
235
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.bubble-chart-container[data-v-6eab8e5c]{position:relative;width:100%;height:100%;overflow:hidden}canvas[data-v-6eab8e5c]{display:block;width:100%;height:100%}.bubble-tooltip[data-v-6eab8e5c]{position:absolute;background:#000c;color:#fff;padding:8px 12px;border-radius:4px;font-size:14px;pointer-events:none;z-index:10;min-width:80px;box-shadow:0 2px 8px #0000004d;border:1px solid #1982e0}
|
package/lib/GDialog/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("../index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("../index-B86xv9Xx.js"),z=require("../_plugin-vue_export-helper-BHFhmbuH.js"),f={small:"480px",medium:"580px",large:"680px"},S={class:"g-dialog-header"},y={class:"g-dialog-operation-container"},b=e.defineComponent({name:"GDialog",inheritAttrs:!1,__name:"index",props:{title:{default:""},size:{default:""}},emits:["cancel","reset","save","minimize"],setup(a,{emit:p}){const n=a,s=p,_=e.computed(()=>n.size&&n.size in f?f[n.size]:n.size);function v(){s("cancel")}function C(){s("reset")}function g(){s("save")}const c=e.ref(!1),x=()=>{c.value=!c.value},d=e.ref(!1),u=e.ref(!0),V=()=>{u.value=!1,d.value=!0},N=()=>{u.value=!0,d.value=!1},h=e.computed(()=>({position:"fixed",bottom:"20px",right:"20px",width:"50px",height:"50px","z-index":"1000"}));return e.onMounted(()=>{}),e.onUnmounted(()=>{}),(l,t)=>{const i=e.resolveComponent("el-icon"),m=e.resolveComponent("el-button"),k=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[u.value?(e.openBlock(),e.createBlock(k,e.mergeProps({key:0},l.$attrs,{width:_.value,"lock-scroll":!1,"show-close":!1,fullscreen:c.value}),{header:e.withCtx(({close:w})=>[e.createElementVNode("div",S,[e.createElementVNode("p",null,e.toDisplayString(l.title),1),e.createElementVNode("div",y,[e.createVNode(i,{onClick:V,class:"g-icon--minimize"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.minus_default))]),_:1}),e.createVNode(i,{onClick:x,class:"g-icon--fullScreen"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.full_screen_default))]),_:1}),e.createVNode(i,{onClick:w,class:"g-icon--close"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.close_default))]),_:2},1032,["onClick"])])])]),footer:e.withCtx(()=>[e.createVNode(m,{onClick:v},{default:e.withCtx(()=>t[0]||(t[0]=[e.createTextVNode(" 取消 ")])),_:1,__:[0]}),e.createVNode(m,{onClick:C},{default:e.withCtx(()=>t[1]||(t[1]=[e.createTextVNode(" 重置 ")])),_:1,__:[1]}),e.createVNode(m,{type:"primary",onClick:g},{default:e.withCtx(()=>t[2]||(t[2]=[e.createTextVNode(" 保存 ")])),_:1,__:[2]}),e.renderSlot(l.$slots,"moreOperations",{},void 0,!0)]),default:e.withCtx(()=>[e.renderSlot(l.$slots,"default",{},void 0,!0)]),_:3},16,["width","fullscreen"])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"g-dialog-minimized-icon",onClick:N,style:e.normalizeStyle(h.value)},[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(r.chat_dot_round_default))]),_:1})],4)):e.createCommentVNode("",!0)])}}}),o=z._export_sfc(b,[["__scopeId","data-v-4d2e56a0"]]);o.install=a=>{a.component(o.name,o)};exports.GDialog=o;exports.default=o;
|
package/lib/GDialog/index.mjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { defineComponent as $, computed as
|
|
2
|
-
import { m as Z, f as j, c as q, a as H } from "../index-
|
|
1
|
+
import { defineComponent as $, computed as z, ref as f, onMounted as A, onUnmounted as M, resolveComponent as p, createBlock as C, openBlock as _, Teleport as T, createCommentVNode as x, createElementBlock as F, mergeProps as L, withCtx as t, renderSlot as h, createVNode as e, createTextVNode as v, createElementVNode as g, toDisplayString as P, unref as s, normalizeStyle as U } from "vue";
|
|
2
|
+
import { m as Z, f as j, c as q, a as H } from "../index-DSzb017c.mjs";
|
|
3
3
|
import { _ as J } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
4
|
-
const
|
|
4
|
+
const y = {
|
|
5
|
+
small: "480px",
|
|
6
|
+
medium: "580px",
|
|
7
|
+
large: "680px"
|
|
8
|
+
}, K = { class: "g-dialog-header" }, Q = { class: "g-dialog-operation-container" }, R = /* @__PURE__ */ $({
|
|
5
9
|
name: "GDialog",
|
|
6
10
|
inheritAttrs: !1,
|
|
7
11
|
__name: "index",
|
|
@@ -11,11 +15,7 @@ const K = { class: "g-dialog-header" }, Q = { class: "g-dialog-operation-contain
|
|
|
11
15
|
},
|
|
12
16
|
emits: ["cancel", "reset", "save", "minimize"],
|
|
13
17
|
setup(a, { emit: S }) {
|
|
14
|
-
const l = a,
|
|
15
|
-
small: "480px",
|
|
16
|
-
medium: "580px",
|
|
17
|
-
large: "680px"
|
|
18
|
-
}, w = C(() => l.size && l.size in z ? z[l.size] : l.size), r = S;
|
|
18
|
+
const l = a, r = S, w = z(() => l.size && l.size in y ? y[l.size] : l.size);
|
|
19
19
|
function b() {
|
|
20
20
|
r("cancel");
|
|
21
21
|
}
|
|
@@ -31,7 +31,7 @@ const K = { class: "g-dialog-header" }, Q = { class: "g-dialog-operation-contain
|
|
|
31
31
|
d.value = !1, u.value = !0;
|
|
32
32
|
}, B = () => {
|
|
33
33
|
d.value = !0, u.value = !1;
|
|
34
|
-
}, E =
|
|
34
|
+
}, E = z(() => ({
|
|
35
35
|
position: "fixed",
|
|
36
36
|
bottom: "20px",
|
|
37
37
|
right: "20px",
|
|
@@ -43,8 +43,8 @@ const K = { class: "g-dialog-header" }, Q = { class: "g-dialog-operation-contain
|
|
|
43
43
|
}), M(() => {
|
|
44
44
|
}), (n, o) => {
|
|
45
45
|
const i = p("el-icon"), m = p("el-button"), G = p("el-dialog");
|
|
46
|
-
return _(),
|
|
47
|
-
d.value ? (_(),
|
|
46
|
+
return _(), C(T, { to: "body" }, [
|
|
47
|
+
d.value ? (_(), C(G, L({ key: 0 }, n.$attrs, {
|
|
48
48
|
width: w.value,
|
|
49
49
|
"lock-scroll": !1,
|
|
50
50
|
"show-close": !1,
|
|
@@ -109,13 +109,13 @@ const K = { class: "g-dialog-header" }, Q = { class: "g-dialog-operation-contain
|
|
|
109
109
|
_: 1,
|
|
110
110
|
__: [2]
|
|
111
111
|
}),
|
|
112
|
-
|
|
112
|
+
h(n.$slots, "moreOperations", {}, void 0, !0)
|
|
113
113
|
]),
|
|
114
114
|
default: t(() => [
|
|
115
|
-
|
|
115
|
+
h(n.$slots, "default", {}, void 0, !0)
|
|
116
116
|
]),
|
|
117
117
|
_: 3
|
|
118
|
-
}, 16, ["width", "fullscreen"])) :
|
|
118
|
+
}, 16, ["width", "fullscreen"])) : x("", !0),
|
|
119
119
|
u.value ? (_(), F("div", {
|
|
120
120
|
key: 1,
|
|
121
121
|
class: "g-dialog-minimized-icon",
|
|
@@ -128,11 +128,11 @@ const K = { class: "g-dialog-header" }, Q = { class: "g-dialog-operation-contain
|
|
|
128
128
|
]),
|
|
129
129
|
_: 1
|
|
130
130
|
})
|
|
131
|
-
], 4)) :
|
|
131
|
+
], 4)) : x("", !0)
|
|
132
132
|
]);
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
}), k = /* @__PURE__ */ J(R, [["__scopeId", "data-v-
|
|
135
|
+
}), k = /* @__PURE__ */ J(R, [["__scopeId", "data-v-4d2e56a0"]]);
|
|
136
136
|
k.install = (a) => {
|
|
137
137
|
a.component(k.name, k);
|
|
138
138
|
};
|
package/lib/GDialog/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-dialog-header[data-v-
|
|
1
|
+
@charset "UTF-8";.g-dialog-header[data-v-4d2e56a0]{display:flex;flex-direction:row;justify-content:space-between;gap:16px}.g-dialog-header>p[data-v-4d2e56a0]{margin-top:-8px}.g-dialog-header .g-dialog-operation-container[data-v-4d2e56a0]{display:flex;flex-direction:row;justify-content:space-between;gap:8px;font-size:12px}.g-dialog-header .g-dialog-operation-container .g-icon--close[data-v-4d2e56a0],.g-dialog-header .g-dialog-operation-container .g-icon--fullScreen[data-v-4d2e56a0],.g-dialog-header .g-dialog-operation-container .g-icon--minimize[data-v-4d2e56a0]{cursor:pointer}.g-dialog-header .g-dialog-operation-container .g-icon--close[data-v-4d2e56a0]:hover,.g-dialog-header .g-dialog-operation-container .g-icon--fullScreen[data-v-4d2e56a0]:hover,.g-dialog-header .g-dialog-operation-container .g-icon--minimize[data-v-4d2e56a0]:hover{color:var(--el-color-primary);transition:all .3s ease}.g-dialog-minimized-icon[data-v-4d2e56a0]{position:fixed;bottom:20px;width:50px;height:50px;border-radius:50%;background-color:var(--el-color-primary);color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:1000;box-shadow:0 2px 12px #0000001a;transition:all .5s ease}.g-dialog-minimized-icon[data-v-4d2e56a0]:hover{animation:bounce-4d2e56a0 .6s ease-in-out 2;box-shadow:0 4px 16px #0003}@keyframes bounce-4d2e56a0{0%,to{transform:translateY(0)}50%{transform:translateY(-7px)}}.g-dialog-minimized-icon .el-icon[data-v-4d2e56a0]{font-size:24px}
|
package/lib/GPercent/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),C=require("../_plugin-vue_export-helper-BHFhmbuH.js"),O="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='11px'%20height='12px'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='matrix(1%200%200%201%20-1755%20-466%20)'%3e%3cpath%20d='M%201755.77886671114%20477.5%20L%201760.5%20467.199345551568%20L%201765.22113328886%20477.5%20L%201755.77886671114%20477.5%20Z%20'%20fill-rule='nonzero'%20fill='%23fa3239'%20stroke='none'%20/%3e%3cpath%20d='M%201755%20478%20L%201760.5%20466%20L%201766%20478%20L%201755%20478%20Z%20M%201760.5%20468.398691103136%20L%201756.55773342227%20477%20L%201764.44226657773%20477%20L%201760.5%20468.398691103136%20Z%20'%20fill-rule='nonzero'%20fill='%23797979'%20stroke='none'%20/%3e%3c/g%3e%3c/svg%3e",W="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='11px'%20height='12px'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='matrix(1%200%200%201%20-1755%20-304%20)'%3e%3cpath%20d='M%201755.77886671114%20315.5%20L%201760.5%20305.199345551568%20L%201765.22113328886%20315.5%20L%201755.77886671114%20315.5%20Z%20'%20fill-rule='nonzero'%20fill='%232ce534'%20stroke='none'%20/%3e%3cpath%20d='M%201755%20316%20L%201760.5%20304%20L%201766%20316%20L%201755%20316%20Z%20M%201760.5%20306.398691103136%20L%201756.55773342227%20315%20L%201764.44226657773%20315%20L%201760.5%20306.398691103136%20Z%20'%20fill-rule='nonzero'%20fill='%23797979'%20stroke='none'%20/%3e%3c/g%3e%3c/svg%3e",B={class:"g-percent-symbol-updown"},D={src:O,alt:"down",style:{transform:"rotate(180deg)"},class:"g-percent-svg"},G={src:W,alt:"up",class:"g-percent-svg"},R=e.defineComponent({name:"GPercent",__name:"index",props:{to:{default:0},from:{default:0},direction:{default:"up"},delay:{default:0},duration:{default:1},decimalPlaces:{default:0},startWhen:{type:Boolean,default:!0},onStart:{type:Function,default:()=>{}},onEnd:{type:Function,default:()=>{}},className:{default:""}},emits:{start:()=>!0,end:()=>!0,complete:()=>!0},setup(d,{emit:y}){const t=d,{to:f,from:v,direction:g,delay:k,duration:w,decimalPlaces:h,startWhen:S,onStart:x,onEnd:_,className:V}=t,m=y,p=e.ref(null),n=e.ref(g==="down"?f:v),i=e.ref(!1),o=e.ref(null),c=e.ref(!1);let r=null;const E=e.computed(()=>20+40*(1/w)),F=e.computed(()=>200*(1/w));let l=0;const L=u=>{const a=g==="down"?v:f,P=n.value,M=a-P,I=M*F.value,Z=l*E.value,A=I-Z;l+=A*.016,n.value+=l*.016,n.value=Math.max(0,Math.min(100,n.value));const T=Math.pow(10,-h)*.1,q=Math.pow(10,-h)*.1;Math.abs(M)>T||Math.abs(l)>q?o.value=requestAnimationFrame(L):(n.value=a,o.value=null,_&&_(),m("end"),m("complete"))},b=()=>{c.value||!i.value||!S||(c.value=!0,x&&x(),m("start"),setTimeout(()=>{l=0,o.value=requestAnimationFrame(L)},k*1e3))},N=()=>{p.value&&(r=new IntersectionObserver(([u])=>{u.isIntersecting&&!i.value&&(i.value=!0,b())},{threshold:0,rootMargin:"0px"}),r.observe(p.value))},z=()=>{o.value&&(cancelAnimationFrame(o.value),o.value=null),r&&(r.disconnect(),r=null)};return e.watch([()=>t.from,()=>t.to,()=>t.direction],()=>{n.value=t.direction==="down"?t.to:t.from,c.value=!1},{immediate:!0}),e.watch(()=>t.startWhen,()=>{t.startWhen&&i.value&&!c.value&&b()}),e.onMounted(async()=>{await e.nextTick(),N()}),e.onUnmounted(()=>{z()}),(u,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"elementRef",ref:p,class:e.normalizeClass([e.unref(V),"g-percent-container"])},[e.createElementVNode("div",B,[e.withDirectives(e.createElementVNode("img",D,null,512),[[e.vShow,t.direction==="down"]]),e.withDirectives(e.createElementVNode("img",G,null,512),[[e.vShow,t.direction==="up"]])]),e.createElementVNode("span",{class:e.normalizeClass(["g-percent-number",{"g-percent-number-down":t.direction==="down","g-percent-number-up":t.direction==="up"}])},e.toDisplayString(n.value.toFixed(t.decimalPlaces)),3),e.createElementVNode("div",{class:e.normalizeClass(["g-percent-symbol",{"g-percent-number-down":t.direction==="down","g-percent-number-up":t.direction==="up"}])},[e.renderSlot(u.$slots,"symbol",{},()=>[a[0]||(a[0]=e.createTextVNode("%"))],!0)],2)],2))}}),s=C._export_sfc(R,[["__scopeId","data-v-555cb69f"]]);s.install=d=>{d.component(s.name,s)};exports.GPercent=s;exports.default=s;
|
package/lib/GPercent/index.mjs
CHANGED
|
@@ -1,102 +1,127 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _ as
|
|
3
|
-
const
|
|
4
|
-
src:
|
|
1
|
+
import { defineComponent as R, ref as s, computed as F, watch as I, onMounted as U, nextTick as $, onUnmounted as j, createElementBlock as H, openBlock as J, normalizeClass as f, unref as K, createElementVNode as l, withDirectives as S, vShow as Z, toDisplayString as Q, renderSlot as X, createTextVNode as Y } from "vue";
|
|
2
|
+
import { _ as ee } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
3
|
+
const te = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='11px'%20height='12px'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='matrix(1%200%200%201%20-1755%20-466%20)'%3e%3cpath%20d='M%201755.77886671114%20477.5%20L%201760.5%20467.199345551568%20L%201765.22113328886%20477.5%20L%201755.77886671114%20477.5%20Z%20'%20fill-rule='nonzero'%20fill='%23fa3239'%20stroke='none'%20/%3e%3cpath%20d='M%201755%20478%20L%201760.5%20466%20L%201766%20478%20L%201755%20478%20Z%20M%201760.5%20468.398691103136%20L%201756.55773342227%20477%20L%201764.44226657773%20477%20L%201760.5%20468.398691103136%20Z%20'%20fill-rule='nonzero'%20fill='%23797979'%20stroke='none'%20/%3e%3c/g%3e%3c/svg%3e", ne = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3csvg%20version='1.1'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='11px'%20height='12px'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20transform='matrix(1%200%200%201%20-1755%20-304%20)'%3e%3cpath%20d='M%201755.77886671114%20315.5%20L%201760.5%20305.199345551568%20L%201765.22113328886%20315.5%20L%201755.77886671114%20315.5%20Z%20'%20fill-rule='nonzero'%20fill='%232ce534'%20stroke='none'%20/%3e%3cpath%20d='M%201755%20316%20L%201760.5%20304%20L%201766%20316%20L%201755%20316%20Z%20M%201760.5%20306.398691103136%20L%201756.55773342227%20315%20L%201764.44226657773%20315%20L%201760.5%20306.398691103136%20Z%20'%20fill-rule='nonzero'%20fill='%23797979'%20stroke='none'%20/%3e%3c/g%3e%3c/svg%3e", oe = { class: "g-percent-symbol-updown" }, re = {
|
|
4
|
+
src: te,
|
|
5
5
|
alt: "down",
|
|
6
6
|
style: { transform: "rotate(180deg)" },
|
|
7
7
|
class: "g-percent-svg"
|
|
8
|
-
},
|
|
9
|
-
src:
|
|
8
|
+
}, ae = {
|
|
9
|
+
src: ne,
|
|
10
10
|
alt: "up",
|
|
11
11
|
class: "g-percent-svg"
|
|
12
|
-
},
|
|
12
|
+
}, se = /* @__PURE__ */ R({
|
|
13
13
|
name: "GPercent",
|
|
14
14
|
__name: "index",
|
|
15
15
|
props: {
|
|
16
|
-
to: {},
|
|
16
|
+
to: { default: 0 },
|
|
17
17
|
from: { default: 0 },
|
|
18
|
-
direction: { default: "" },
|
|
18
|
+
direction: { default: "up" },
|
|
19
19
|
delay: { default: 0 },
|
|
20
|
-
duration: { default:
|
|
21
|
-
className: { default: "" },
|
|
22
|
-
startWhen: { type: Boolean, default: !0 },
|
|
20
|
+
duration: { default: 1 },
|
|
23
21
|
decimalPlaces: { default: 0 },
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
startWhen: { type: Boolean, default: !0 },
|
|
23
|
+
onStart: { type: Function, default: () => {
|
|
24
|
+
} },
|
|
25
|
+
onEnd: { type: Function, default: () => {
|
|
26
|
+
} },
|
|
27
|
+
className: { default: "" }
|
|
28
|
+
},
|
|
29
|
+
emits: {
|
|
30
|
+
/**
|
|
31
|
+
* @description 动画开始时触发钩子
|
|
32
|
+
* @version 0.1.5
|
|
33
|
+
* @param void 无参数
|
|
34
|
+
* @example 1
|
|
35
|
+
*/
|
|
36
|
+
start: () => !0,
|
|
37
|
+
/**
|
|
38
|
+
* @description 动画结束时触发钩子
|
|
39
|
+
* @version 0.1.5
|
|
40
|
+
* @param void 无参数
|
|
41
|
+
* @example 1
|
|
42
|
+
*/
|
|
43
|
+
end: () => !0,
|
|
44
|
+
/**
|
|
45
|
+
* @description 动画完成时触发钩子
|
|
46
|
+
* @version 0.1.5
|
|
47
|
+
* @param void 无参数
|
|
48
|
+
* @example 1
|
|
49
|
+
*/
|
|
50
|
+
complete: () => !0
|
|
26
51
|
},
|
|
27
|
-
setup(d) {
|
|
28
|
-
const e = d, m =
|
|
52
|
+
setup(d, { emit: z }) {
|
|
53
|
+
const e = d, { to: g, from: w, direction: h, delay: A, duration: x, decimalPlaces: _, startWhen: P, onStart: L, onEnd: b, className: E } = e, m = z, p = s(null), t = s(h === "down" ? g : w), i = s(!1), n = s(null), c = s(!1);
|
|
29
54
|
let o = null;
|
|
30
|
-
const
|
|
55
|
+
const N = F(() => 20 + 40 * (1 / x)), T = F(() => 200 * (1 / x));
|
|
31
56
|
let r = 0;
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
r +=
|
|
35
|
-
const
|
|
36
|
-
Math.abs(
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
r = 0, n.value = requestAnimationFrame(
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
([
|
|
44
|
-
|
|
57
|
+
const y = (u) => {
|
|
58
|
+
const a = h === "down" ? w : g, B = t.value, k = a - B, O = k * T.value, q = r * N.value, C = O - q;
|
|
59
|
+
r += C * 0.016, t.value += r * 0.016, t.value = Math.max(0, Math.min(100, t.value));
|
|
60
|
+
const D = Math.pow(10, -_) * 0.1, G = Math.pow(10, -_) * 0.1;
|
|
61
|
+
Math.abs(k) > D || Math.abs(r) > G ? n.value = requestAnimationFrame(y) : (t.value = a, n.value = null, b && b(), m("end"), m("complete"));
|
|
62
|
+
}, M = () => {
|
|
63
|
+
c.value || !i.value || !P || (c.value = !0, L && L(), m("start"), setTimeout(() => {
|
|
64
|
+
r = 0, n.value = requestAnimationFrame(y);
|
|
65
|
+
}, A * 1e3));
|
|
66
|
+
}, V = () => {
|
|
67
|
+
p.value && (o = new IntersectionObserver(
|
|
68
|
+
([u]) => {
|
|
69
|
+
u.isIntersecting && !i.value && (i.value = !0, M());
|
|
45
70
|
},
|
|
46
71
|
{
|
|
47
72
|
threshold: 0,
|
|
48
73
|
rootMargin: "0px"
|
|
49
74
|
// 根容器的边距(类似CSS margin)
|
|
50
75
|
}
|
|
51
|
-
), o.observe(
|
|
52
|
-
},
|
|
76
|
+
), o.observe(p.value));
|
|
77
|
+
}, W = () => {
|
|
53
78
|
n.value && (cancelAnimationFrame(n.value), n.value = null), o && (o.disconnect(), o = null);
|
|
54
79
|
};
|
|
55
|
-
return
|
|
80
|
+
return I(
|
|
56
81
|
[() => e.from, () => e.to, () => e.direction],
|
|
57
82
|
() => {
|
|
58
|
-
t.value = e.direction === "down" ? e.to : e.from,
|
|
83
|
+
t.value = e.direction === "down" ? e.to : e.from, c.value = !1;
|
|
59
84
|
},
|
|
60
85
|
{ immediate: !0 }
|
|
61
|
-
),
|
|
86
|
+
), I(
|
|
62
87
|
() => e.startWhen,
|
|
63
88
|
() => {
|
|
64
|
-
e.startWhen &&
|
|
89
|
+
e.startWhen && i.value && !c.value && M();
|
|
65
90
|
}
|
|
66
|
-
),
|
|
67
|
-
await
|
|
68
|
-
}),
|
|
69
|
-
|
|
70
|
-
}), (
|
|
91
|
+
), U(async () => {
|
|
92
|
+
await $(), V();
|
|
93
|
+
}), j(() => {
|
|
94
|
+
W();
|
|
95
|
+
}), (u, a) => (J(), H("div", {
|
|
71
96
|
ref_key: "elementRef",
|
|
72
|
-
ref:
|
|
73
|
-
class:
|
|
97
|
+
ref: p,
|
|
98
|
+
class: f([K(E), "g-percent-container"])
|
|
74
99
|
}, [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
[
|
|
100
|
+
l("div", oe, [
|
|
101
|
+
S(l("img", re, null, 512), [
|
|
102
|
+
[Z, e.direction === "down"]
|
|
78
103
|
]),
|
|
79
|
-
|
|
80
|
-
[
|
|
104
|
+
S(l("img", ae, null, 512), [
|
|
105
|
+
[Z, e.direction === "up"]
|
|
81
106
|
])
|
|
82
107
|
]),
|
|
83
|
-
|
|
84
|
-
class:
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
class:
|
|
108
|
+
l("span", {
|
|
109
|
+
class: f(["g-percent-number", { "g-percent-number-down": e.direction === "down", "g-percent-number-up": e.direction === "up" }])
|
|
110
|
+
}, Q(t.value.toFixed(e.decimalPlaces)), 3),
|
|
111
|
+
l("div", {
|
|
112
|
+
class: f(["g-percent-symbol", { "g-percent-number-down": e.direction === "down", "g-percent-number-up": e.direction === "up" }])
|
|
88
113
|
}, [
|
|
89
|
-
|
|
90
|
-
|
|
114
|
+
X(u.$slots, "symbol", {}, () => [
|
|
115
|
+
a[0] || (a[0] = Y("%"))
|
|
91
116
|
], !0)
|
|
92
117
|
], 2)
|
|
93
118
|
], 2));
|
|
94
119
|
}
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
d.component(
|
|
120
|
+
}), v = /* @__PURE__ */ ee(se, [["__scopeId", "data-v-555cb69f"]]);
|
|
121
|
+
v.install = (d) => {
|
|
122
|
+
d.component(v.name, v);
|
|
98
123
|
};
|
|
99
124
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
v as GPercent,
|
|
126
|
+
v as default
|
|
102
127
|
};
|
package/lib/GPercent/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.g-percent-container[data-v-
|
|
1
|
+
.g-percent-container[data-v-555cb69f]{display:inline-flex;align-items:center;justify-content:center}.g-percent-number-down[data-v-555cb69f]{color:#ff4d4f}.g-percent-number-up[data-v-555cb69f]{color:#52c41a}.g-percent-svg[data-v-555cb69f]{width:8px;height:8px}
|