geekin-devtoys 0.1.5 → 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.
@@ -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}
@@ -1 +1 @@
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"),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,f={small:"480px",medium:"580px",large:"680px"},_=e.computed(()=>n.size&&n.size in f?f[n.size]:n.size),s=p;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-f70461e0"]]);o.install=a=>{a.component(o.name,o)};exports.GDialog=o;exports.default=o;
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;
@@ -1,7 +1,11 @@
1
- import { defineComponent as $, computed as C, ref as f, onMounted as A, onUnmounted as M, resolveComponent as p, createBlock as x, openBlock as _, Teleport as T, createCommentVNode as h, createElementBlock as F, mergeProps as L, withCtx as t, renderSlot as y, createVNode as e, createTextVNode as v, createElementVNode as g, toDisplayString as P, unref as s, normalizeStyle as U } from "vue";
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
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 K = { class: "g-dialog-header" }, Q = { class: "g-dialog-operation-container" }, R = /* @__PURE__ */ $({
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, z = {
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 = C(() => ({
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 _(), x(T, { to: "body" }, [
47
- d.value ? (_(), x(G, L({ key: 0 }, n.$attrs, {
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
- y(n.$slots, "moreOperations", {}, void 0, !0)
112
+ h(n.$slots, "moreOperations", {}, void 0, !0)
113
113
  ]),
114
114
  default: t(() => [
115
- y(n.$slots, "default", {}, void 0, !0)
115
+ h(n.$slots, "default", {}, void 0, !0)
116
116
  ]),
117
117
  _: 3
118
- }, 16, ["width", "fullscreen"])) : h("", !0),
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)) : h("", !0)
131
+ ], 4)) : x("", !0)
132
132
  ]);
133
133
  };
134
134
  }
135
- }), k = /* @__PURE__ */ J(R, [["__scopeId", "data-v-f70461e0"]]);
135
+ }), k = /* @__PURE__ */ J(R, [["__scopeId", "data-v-4d2e56a0"]]);
136
136
  k.install = (a) => {
137
137
  a.component(k.name, k);
138
138
  };
@@ -1 +1 @@
1
- @charset "UTF-8";.g-dialog-header[data-v-f70461e0]{display:flex;flex-direction:row;justify-content:space-between;gap:16px}.g-dialog-header>p[data-v-f70461e0]{margin-top:-8px}.g-dialog-header .g-dialog-operation-container[data-v-f70461e0]{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-f70461e0],.g-dialog-header .g-dialog-operation-container .g-icon--fullScreen[data-v-f70461e0],.g-dialog-header .g-dialog-operation-container .g-icon--minimize[data-v-f70461e0]{cursor:pointer}.g-dialog-header .g-dialog-operation-container .g-icon--close[data-v-f70461e0]:hover,.g-dialog-header .g-dialog-operation-container .g-icon--fullScreen[data-v-f70461e0]:hover,.g-dialog-header .g-dialog-operation-container .g-icon--minimize[data-v-f70461e0]:hover{color:var(--el-color-primary);transition:all .3s ease}.g-dialog-minimized-icon[data-v-f70461e0]{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-f70461e0]:hover{animation:bounce-f70461e0 .6s ease-in-out 2;box-shadow:0 4px 16px #0003}@keyframes bounce-f70461e0{0%,to{transform:translateY(0)}50%{transform:translateY(-7px)}}.g-dialog-minimized-icon .el-icon[data-v-f70461e0]{font-size:24px}
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}
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),S=require("../_plugin-vue_export-helper-BHFhmbuH.js"),E="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",V="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",N={class:"g-percent-symbol-updown"},P={src:E,alt:"down",style:{transform:"rotate(180deg)"},class:"g-percent-svg"},z={src:V,alt:"up",class:"g-percent-svg"},F=t.defineComponent({name:"GPercent",__name:"index",props:{to:{},from:{default:0},direction:{default:""},delay:{default:0},duration:{default:2},className:{default:""},startWhen:{type:Boolean,default:!0},decimalPlaces:{default:0},onStart:{},onEnd:{}},setup(d){const e=d,m=t.ref(null),n=t.ref(e.direction==="down"?e.to:e.from),c=t.ref(!1),o=t.ref(null),u=t.ref(!1);let r=null;const g=t.computed(()=>20+40*(1/e.duration)),w=t.computed(()=>200*(1/e.duration));let a=0;const p=l=>{const s=e.direction==="down"?e.from:e.to,_=n.value,f=s-_,L=f*w.value,b=a*g.value,M=L-b;a+=M*.016,n.value+=a*.016,n.value=Math.max(0,Math.min(100,n.value));const y=Math.pow(10,-e.decimalPlaces)*.1,k=Math.pow(10,-e.decimalPlaces)*.1;Math.abs(f)>y||Math.abs(a)>k?o.value=requestAnimationFrame(p):(n.value=s,o.value=null,e.onEnd&&e.onEnd())},v=()=>{u.value||!c.value||!e.startWhen||(u.value=!0,e.onStart&&e.onStart(),setTimeout(()=>{a=0,o.value=requestAnimationFrame(p)},e.delay*1e3))},h=()=>{m.value&&(r=new IntersectionObserver(([l])=>{l.isIntersecting&&!c.value&&(c.value=!0,v())},{threshold:0,rootMargin:"0px"}),r.observe(m.value))},x=()=>{o.value&&(cancelAnimationFrame(o.value),o.value=null),r&&(r.disconnect(),r=null)};return t.watch([()=>e.from,()=>e.to,()=>e.direction],()=>{n.value=e.direction==="down"?e.to:e.from,u.value=!1},{immediate:!0}),t.watch(()=>e.startWhen,()=>{e.startWhen&&c.value&&!u.value&&v()}),t.onMounted(async()=>{await t.nextTick(),h()}),t.onUnmounted(()=>{x()}),(l,s)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"elementRef",ref:m,class:t.normalizeClass([l.className,"g-percent-container"])},[t.createElementVNode("div",N,[t.withDirectives(t.createElementVNode("img",P,null,512),[[t.vShow,e.direction==="down"]]),t.withDirectives(t.createElementVNode("img",z,null,512),[[t.vShow,e.direction==="up"]])]),t.createElementVNode("span",{class:t.normalizeClass(["g-percent-number",{"g-percent-number-down":e.direction==="down","g-percent-number-up":e.direction==="up"}])},t.toDisplayString(n.value.toFixed(e.decimalPlaces)),3),t.createElementVNode("div",{class:t.normalizeClass(["g-percent-symbol",{"g-percent-number-down":e.direction==="down","g-percent-number-up":e.direction==="up"}])},[t.renderSlot(l.$slots,"symbol",{},()=>[s[0]||(s[0]=t.createTextVNode("%"))],!0)],2)],2))}}),i=S._export_sfc(F,[["__scopeId","data-v-6eeb4548"]]);i.install=d=>{d.component(i.name,i)};exports.GPercent=i;exports.default=i;
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;
@@ -1,102 +1,127 @@
1
- import { defineComponent as A, ref as l, computed as h, watch as x, onMounted as E, nextTick as N, onUnmounted as T, createElementBlock as V, openBlock as W, normalizeClass as p, createElementVNode as i, withDirectives as L, vShow as _, toDisplayString as B, renderSlot as O, createTextVNode as q } from "vue";
2
- import { _ as C } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
3
- const D = "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", G = "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", R = { class: "g-percent-symbol-updown" }, U = {
4
- src: D,
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: G,
8
+ }, ae = {
9
+ src: ne,
10
10
  alt: "up",
11
11
  class: "g-percent-svg"
12
- }, j = /* @__PURE__ */ A({
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: 2 },
21
- className: { default: "" },
22
- startWhen: { type: Boolean, default: !0 },
20
+ duration: { default: 1 },
23
21
  decimalPlaces: { default: 0 },
24
- onStart: {},
25
- onEnd: {}
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 = l(null), t = l(e.direction === "down" ? e.to : e.from), c = l(!1), n = l(null), u = l(!1);
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 b = h(() => 20 + 40 * (1 / e.duration)), M = h(() => 200 * (1 / e.duration));
55
+ const N = F(() => 20 + 40 * (1 / x)), T = F(() => 200 * (1 / x));
31
56
  let r = 0;
32
- const v = (a) => {
33
- const s = e.direction === "down" ? e.from : e.to, S = t.value, w = s - S, F = w * M.value, I = r * b.value, P = F - I;
34
- r += P * 0.016, t.value += r * 0.016, t.value = Math.max(0, Math.min(100, t.value));
35
- const Z = Math.pow(10, -e.decimalPlaces) * 0.1, z = Math.pow(10, -e.decimalPlaces) * 0.1;
36
- Math.abs(w) > Z || Math.abs(r) > z ? n.value = requestAnimationFrame(v) : (t.value = s, n.value = null, e.onEnd && e.onEnd());
37
- }, g = () => {
38
- u.value || !c.value || !e.startWhen || (u.value = !0, e.onStart && e.onStart(), setTimeout(() => {
39
- r = 0, n.value = requestAnimationFrame(v);
40
- }, e.delay * 1e3));
41
- }, k = () => {
42
- m.value && (o = new IntersectionObserver(
43
- ([a]) => {
44
- a.isIntersecting && !c.value && (c.value = !0, g());
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(m.value));
52
- }, y = () => {
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 x(
80
+ return I(
56
81
  [() => e.from, () => e.to, () => e.direction],
57
82
  () => {
58
- t.value = e.direction === "down" ? e.to : e.from, u.value = !1;
83
+ t.value = e.direction === "down" ? e.to : e.from, c.value = !1;
59
84
  },
60
85
  { immediate: !0 }
61
- ), x(
86
+ ), I(
62
87
  () => e.startWhen,
63
88
  () => {
64
- e.startWhen && c.value && !u.value && g();
89
+ e.startWhen && i.value && !c.value && M();
65
90
  }
66
- ), E(async () => {
67
- await N(), k();
68
- }), T(() => {
69
- y();
70
- }), (a, s) => (W(), V("div", {
91
+ ), U(async () => {
92
+ await $(), V();
93
+ }), j(() => {
94
+ W();
95
+ }), (u, a) => (J(), H("div", {
71
96
  ref_key: "elementRef",
72
- ref: m,
73
- class: p([a.className, "g-percent-container"])
97
+ ref: p,
98
+ class: f([K(E), "g-percent-container"])
74
99
  }, [
75
- i("div", R, [
76
- L(i("img", U, null, 512), [
77
- [_, e.direction === "down"]
100
+ l("div", oe, [
101
+ S(l("img", re, null, 512), [
102
+ [Z, e.direction === "down"]
78
103
  ]),
79
- L(i("img", $, null, 512), [
80
- [_, e.direction === "up"]
104
+ S(l("img", ae, null, 512), [
105
+ [Z, e.direction === "up"]
81
106
  ])
82
107
  ]),
83
- i("span", {
84
- class: p(["g-percent-number", { "g-percent-number-down": e.direction === "down", "g-percent-number-up": e.direction === "up" }])
85
- }, B(t.value.toFixed(e.decimalPlaces)), 3),
86
- i("div", {
87
- class: p(["g-percent-symbol", { "g-percent-number-down": e.direction === "down", "g-percent-number-up": e.direction === "up" }])
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
- O(a.$slots, "symbol", {}, () => [
90
- s[0] || (s[0] = q("%"))
114
+ X(u.$slots, "symbol", {}, () => [
115
+ a[0] || (a[0] = Y("%"))
91
116
  ], !0)
92
117
  ], 2)
93
118
  ], 2));
94
119
  }
95
- }), f = /* @__PURE__ */ C(j, [["__scopeId", "data-v-6eeb4548"]]);
96
- f.install = (d) => {
97
- d.component(f.name, f);
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
- f as GPercent,
101
- f as default
125
+ v as GPercent,
126
+ v as default
102
127
  };
@@ -1 +1 @@
1
- .g-percent-container[data-v-6eeb4548]{display:inline-flex;align-items:center;justify-content:center}.g-percent-number-down[data-v-6eeb4548]{color:#ff4d4f}.g-percent-number-up[data-v-6eeb4548]{color:#52c41a}.g-percent-svg[data-v-6eeb4548]{width:8px;height:8px}
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}