geekin-devtoys 0.2.11 → 0.2.13

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 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),ft=require("../_plugin-vue_export-helper-BHFhmbuH.js"),ut={class:"g-pie3d-tooltip__default"},pt={class:"g-pie3d-tooltip__name"},vt={class:"g-pie3d-tooltip__value"},gt=260,yt=c.defineComponent({__name:"index",props:{data:{default:()=>[]},config:{default:()=>({})},animation:{type:Boolean,default:!0}},emits:["slice-click"],setup(H,{emit:nt}){const P=H,at=nt,V={alpha:55,depth:26,startAngle:0,colors:["#22d3ee","#3b82f6","#8b5cf6","#06b6d4","#0ea5e9","#a855f7","#14b8a6"],textColor:"#cbd5e1",radiusRatio:.55,hoverDistance:14,showLabel:!0,showPercent:!0,labelFontSize:12,opacity:.7,showAura:!0,glowColor:"",labelLineColor:"auto",labelLineWidth:1},n={...V,...P.config},R=c.ref(null),S=c.ref(null);let E=null,C=0,_=0,L=1,v=0,p=0,g=0,x=0,M=[],B=P.animation?0:1,Y=null,N=P.animation,k=null,X=0;const W=c.ref(-1),$=c.ref(!1),U=c.ref(0),J=c.ref(0),I=c.ref(null),q=c.ref(0),K=t=>t*Math.PI/180,O=(t,s=0,a=0)=>({x:v+s+g*Math.cos(t),y:p+a+x*Math.sin(t)}),j=(t,s=0,a=0)=>({x:v+s+g*Math.cos(t),y:p+a+x*Math.sin(t)+n.depth}),F=()=>{if(!S.value||!R.value)return;const t=R.value,s=S.value;L=window.devicePixelRatio||1,C=t.clientWidth,_=t.clientHeight,s.width=C*L,s.height=_*L,s.style.width=C+"px",s.style.height=_+"px",E=s.getContext("2d"),E&&E.setTransform(L,0,0,L,0,0),v=C/2,p=_/2-n.depth/2;const a=n.showLabel?60:10,h=Math.min(C,_-n.depth-a)/2*n.radiusRatio*1.6;g=Math.max(20,h),x=g*Math.cos(K(n.alpha)),lt(),N?st():G()},lt=()=>{M=[];const t=P.data.reduce((a,h)=>a+(h.value||0),0);if(t<=0)return;let s=-Math.PI/2+K(n.startAngle);P.data.forEach((a,h)=>{const i=a.value/t,f=i*Math.PI*2;M.push({data:a,index:h,color:a.color||n.colors[h%n.colors.length],startA:s,endA:s+f,midA:s+f/2,percent:i,hover:!1,hoverProgress:0}),s+=f})},st=()=>{B=0;const t=800,s=performance.now(),a=h=>{const i=Math.min(1,(h-s)/t);B=1-Math.pow(1-i,3),G(),i<1?Y=requestAnimationFrame(a):(N=!1,Y=null)};Y=requestAnimationFrame(a)},Q=t=>1-Math.pow(1-t,3),Z=t=>{const s=X===0?16:t-X;X=t;const a=s/gt;let h=!1;for(const i of M){const f=i.hover?1:0;if(i.hoverProgress===f)continue;const e=f>i.hoverProgress?1:-1;i.hoverProgress+=e*a,(e>0&&i.hoverProgress>=f||e<0&&i.hoverProgress<=f)&&(i.hoverProgress=f),i.hoverProgress!==f&&(h=!0)}G(),h?k=requestAnimationFrame(Z):(k=null,X=0)},tt=()=>{k==null&&(X=0,k=requestAnimationFrame(Z))},T=(t,s)=>{let a=t.replace("#","");a.length===3&&(a=a.split("").map(e=>e+e).join(""));const h=parseInt(a.slice(0,2),16),i=parseInt(a.slice(2,4),16),f=parseInt(a.slice(4,6),16);return`rgba(${h},${i},${f},${s})`},G=()=>{if(!E)return;const t=E;if(t.clearRect(0,0,C,_),!M.length)return;const s=M[0]?.startA??0,a=Math.PI*2*B,h=s+a,i=M.map(e=>{const l=e.startA,d=Math.min(e.endA,h),u=d>l,y=Q(Math.max(0,Math.min(1,e.hoverProgress))),w=Math.cos(e.midA)*n.hoverDistance*y,b=Math.sin(e.midA)*n.hoverDistance*y;return{...e,startA:l,endA:d,valid:u,ox:w,oy:b,hp:y}});if(n.showAura){const e=t.createRadialGradient(v,p+n.depth,g*.1,v,p+n.depth,g*1.5);e.addColorStop(0,"rgba(6,182,212,0.15)"),e.addColorStop(.4,"rgba(59,130,246,0.08)"),e.addColorStop(.8,"rgba(139,92,246,0.03)"),e.addColorStop(1,"rgba(0,0,0,0)"),t.beginPath(),t.ellipse(v,p+n.depth,g*1.5,x*.9,0,0,Math.PI*2),t.fillStyle=e,t.fill(),t.strokeStyle="rgba(56,189,248,0.08)",t.lineWidth=1;for(let l=3;l>=1;l--){const d=g*(.3+l*.25);t.beginPath(),t.ellipse(v,p+n.depth,d,d*(x/g),0,0,Math.PI*2),t.stroke()}}const f=Math.PI/120;for(const e of i){if(!e.valid)continue;let l=e.startA;const d=n.glowColor||e.color;for(;l<e.endA;){const u=Math.min(l+f,e.endA),y=(l+u)/2;if(Math.sin(y)>0){const w=O(l,e.ox,e.oy),b=O(u,e.ox,e.oy),o=j(u,e.ox,e.oy),m=j(l,e.ox,e.oy);t.fillStyle=T(d,n.opacity*.4),t.beginPath(),t.moveTo(w.x,w.y),t.lineTo(b.x,b.y),t.lineTo(o.x,o.y),t.lineTo(m.x,m.y),t.closePath(),t.fill(),t.strokeStyle=T(d,.7),t.lineWidth=.8,t.beginPath(),t.moveTo(m.x,m.y),t.lineTo(o.x,o.y),t.stroke()}l=u}}for(const e of i){if(!e.valid)continue;const l=[];Math.sin(e.startA)>.001&&l.push({a:e.startA}),Math.sin(e.endA)>.001&&l.push({a:e.endA});const d=n.glowColor||e.color;for(const u of l){const y={x:v+e.ox,y:p+e.oy},w={x:y.x,y:y.y+n.depth},b=O(u.a,e.ox,e.oy),o=j(u.a,e.ox,e.oy);t.fillStyle=T(d,n.opacity*.5),t.beginPath(),t.moveTo(y.x,y.y),t.lineTo(b.x,b.y),t.lineTo(o.x,o.y),t.lineTo(w.x,w.y),t.closePath(),t.fill(),t.strokeStyle=T(d,.8),t.lineWidth=.8,t.beginPath(),t.moveTo(b.x,b.y),t.lineTo(o.x,o.y),t.stroke()}}for(const e of i){if(!e.valid)continue;const l=n.glowColor||e.color;e.hp>.01&&(t.save(),t.shadowColor=l,t.shadowBlur=12*e.hp,t.beginPath(),t.moveTo(v+e.ox,p+e.oy),t.ellipse(v+e.ox,p+e.oy,g,x,0,e.startA,e.endA),t.closePath(),t.fillStyle=T(l,.08*e.hp),t.fill(),t.restore()),t.beginPath(),t.moveTo(v+e.ox,p+e.oy),t.ellipse(v+e.ox,p+e.oy,g,x,0,e.startA,e.endA),t.closePath();const d=t.createRadialGradient(v+e.ox-g*.2,p+e.oy-x*.2,0,v+e.ox,p+e.oy,g*1.05);d.addColorStop(0,T(l,n.opacity*.95)),d.addColorStop(.6,T(l,n.opacity*.8)),d.addColorStop(1,T(l,n.opacity*.6)),t.fillStyle=d,t.fill(),t.strokeStyle=T(l,.95),t.lineWidth=.8+.6*e.hp,t.stroke()}if(n.showLabel&&B>=.999){t.font=`${n.labelFontSize}px Arial, sans-serif`,t.textBaseline="middle";const e=[],l=[],d=n.labelFontSize+6,u=14,y=4;for(const o of i){if(!o.valid)continue;const m=Math.cos(o.midA)>=0,A=v+o.ox+g*1.02*Math.cos(o.midA),r=p+o.oy+x*1.02*Math.sin(o.midA),z=p+o.oy+x*1.18*Math.sin(o.midA),ct=n.showPercent?`${o.data.name} ${(o.percent*100).toFixed(1)}%`:`${o.data.name}`,ht=!n.labelLineColor||n.labelLineColor==="auto"?n.glowColor||o.color:n.labelLineColor,dt={slice:o,text:ct,isRight:m,anchorX:A,anchorY:r,targetY:z,y:z,color:ht};(m?l:e).push(dt)}const w=o=>{if(!o.length)return;o.sort((r,z)=>r.targetY-z.targetY);const m=y+n.labelFontSize/2,A=_-y-n.labelFontSize/2;for(let r=0;r<o.length;r++)r===0?o[r].y=Math.max(m,o[r].targetY):o[r].y=Math.max(o[r].targetY,o[r-1].y+d);if(o[o.length-1].y>A){o[o.length-1].y=A;for(let r=o.length-2;r>=0;r--)o[r].y>o[r+1].y-d&&(o[r].y=o[r+1].y-d)}for(let r=0;r<o.length;r++)o[r].y<m&&(o[r].y=m)};w(e),w(l),t.lineWidth=n.labelLineWidth;const b=[...e,...l];for(const o of b){const m=t.measureText(o.text).width;let A;if(o.isRight){const r=Math.min(Math.max(o.anchorX+6,o.anchorX+Math.abs(o.targetY-o.y)*.2+6),C-y-m-u);A=r+u,t.strokeStyle=o.color,t.beginPath(),t.moveTo(o.anchorX,o.anchorY),t.lineTo(r,o.y),t.lineTo(A,o.y),t.stroke(),t.fillStyle=n.textColor,t.textAlign="left",t.fillText(o.text,A+2,o.y)}else{const r=Math.max(Math.min(o.anchorX-6,o.anchorX-Math.abs(o.targetY-o.y)*.2-6),y+m+u);A=r-u,t.strokeStyle=o.color,t.beginPath(),t.moveTo(o.anchorX,o.anchorY),t.lineTo(r,o.y),t.lineTo(A,o.y),t.stroke(),t.fillStyle=n.textColor,t.textAlign="right",t.fillText(o.text,A-2,o.y)}}}},et=(t,s)=>{for(let a=0;a<M.length;a++){const h=M[a],i=Q(Math.max(0,Math.min(1,h.hoverProgress))),f=Math.cos(h.midA)*n.hoverDistance*i,e=Math.sin(h.midA)*n.hoverDistance*i,l=(t-(v+f))/g,d=(s-(p+e))/x;if(l*l+d*d>1)continue;let u=Math.atan2((s-(p+e))/x,(t-(v+f))/g);for(;u<h.startA;)u+=Math.PI*2;for(;u>h.startA+Math.PI*2;)u-=Math.PI*2;if(u>=h.startA&&u<=h.endA)return a}return-1},it=t=>{if(!S.value)return;const s=S.value.getBoundingClientRect(),a=t.clientX-s.left,h=t.clientY-s.top,i=et(a,h);if(i!==W.value&&(W.value=i,M.forEach((f,e)=>f.hover=e===i),tt()),i>=0){const f=M[i];$.value=!0,I.value=f.data,q.value=f.percent;const e=R.value?.clientWidth||0,l=R.value?.clientHeight||0,d=Math.min(a+12,e-140),u=Math.min(h+12,l-60);U.value=Math.max(0,d),J.value=Math.max(0,u)}else $.value=!1,I.value=null},rt=()=>{W.value!==-1&&(W.value=-1,M.forEach(t=>t.hover=!1),tt()),$.value=!1,I.value=null},ot=t=>{if(!S.value)return;const s=S.value.getBoundingClientRect(),a=et(t.clientX-s.left,t.clientY-s.top);a>=0&&at("slice-click",M[a].data,a)};return c.watch(()=>P.data,()=>{Object.assign(n,V,P.config),N=P.animation,F()},{deep:!0}),c.watch(()=>P.config,()=>{Object.assign(n,V,P.config),F()},{deep:!0}),c.onMounted(()=>{F(),window.addEventListener("resize",F),S.value?.addEventListener("click",ot)}),c.onUnmounted(()=>{window.removeEventListener("resize",F),S.value?.removeEventListener("click",ot),Y&&cancelAnimationFrame(Y),k&&cancelAnimationFrame(k)}),(t,s)=>(c.openBlock(),c.createElementBlock("div",{class:"g-pie3d-container",ref_key:"containerRef",ref:R},[c.createElementVNode("canvas",{ref_key:"canvasRef",ref:S,onMousemove:it,onMouseleave:rt},null,544),$.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"g-pie3d-tooltip",style:c.normalizeStyle({left:`${U.value}px`,top:`${J.value}px`})},[c.renderSlot(t.$slots,"tooltip",{data:I.value,percent:q.value},()=>[c.createElementVNode("div",ut,[c.createElementVNode("p",pt,c.toDisplayString(I.value?.name),1),c.createElementVNode("p",vt,c.toDisplayString(I.value?.value)+" ("+c.toDisplayString((q.value*100).toFixed(1))+"%) ",1)])],!0)],4)):c.createCommentVNode("",!0)],512))}}),D=ft._export_sfc(yt,[["__scopeId","data-v-bf418cec"]]);D.install=H=>{H.component(D.name,D)};exports.GPie3D=D;exports.default=D;
@@ -0,0 +1,277 @@
1
+ import { defineComponent as yt, ref as T, watch as lt, onMounted as mt, onUnmounted as xt, createElementBlock as st, openBlock as it, createElementVNode as z, createCommentVNode as Mt, normalizeStyle as bt, renderSlot as At, toDisplayString as U } from "vue";
2
+ import { _ as Pt } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ const wt = { class: "g-pie3d-tooltip__default" }, St = { class: "g-pie3d-tooltip__name" }, Tt = { class: "g-pie3d-tooltip__value" }, Ct = 260, _t = /* @__PURE__ */ yt({
4
+ __name: "index",
5
+ props: {
6
+ data: { default: () => [] },
7
+ config: { default: () => ({}) },
8
+ animation: { type: Boolean, default: !0 }
9
+ },
10
+ emits: ["slice-click"],
11
+ setup(H, { emit: rt }) {
12
+ const A = H, ct = rt, O = {
13
+ alpha: 55,
14
+ depth: 26,
15
+ startAngle: 0,
16
+ colors: ["#22d3ee", "#3b82f6", "#8b5cf6", "#06b6d4", "#0ea5e9", "#a855f7", "#14b8a6"],
17
+ textColor: "#cbd5e1",
18
+ radiusRatio: 0.55,
19
+ hoverDistance: 14,
20
+ showLabel: !0,
21
+ showPercent: !0,
22
+ labelFontSize: 12,
23
+ opacity: 0.7,
24
+ showAura: !0,
25
+ glowColor: "",
26
+ labelLineColor: "auto",
27
+ labelLineWidth: 1
28
+ }, n = { ...O, ...A.config }, R = T(null), w = T(null);
29
+ let L = null, C = 0, _ = 0, Y = 1, p = 0, u = 0, v = 0, m = 0, x = [], W = A.animation ? 0 : 1, X = null, q = A.animation, k = null, F = 0;
30
+ const $ = T(-1), B = T(!1), K = T(0), Q = T(0), I = T(null), N = T(0), Z = (t) => t * Math.PI / 180, V = (t, s = 0, a = 0) => ({
31
+ x: p + s + v * Math.cos(t),
32
+ y: u + a + m * Math.sin(t)
33
+ }), j = (t, s = 0, a = 0) => ({
34
+ x: p + s + v * Math.cos(t),
35
+ y: u + a + m * Math.sin(t) + n.depth
36
+ }), E = () => {
37
+ if (!w.value || !R.value) return;
38
+ const t = R.value, s = w.value;
39
+ Y = window.devicePixelRatio || 1, C = t.clientWidth, _ = t.clientHeight, s.width = C * Y, s.height = _ * Y, s.style.width = C + "px", s.style.height = _ + "px", L = s.getContext("2d"), L && L.setTransform(Y, 0, 0, Y, 0, 0), p = C / 2, u = _ / 2 - n.depth / 2;
40
+ const a = n.showLabel ? 60 : 10, c = Math.min(C, _ - n.depth - a) / 2 * n.radiusRatio * 1.6;
41
+ v = Math.max(20, c), m = v * Math.cos(Z(n.alpha)), ht(), q ? dt() : G();
42
+ }, ht = () => {
43
+ x = [];
44
+ const t = A.data.reduce((a, c) => a + (c.value || 0), 0);
45
+ if (t <= 0) return;
46
+ let s = -Math.PI / 2 + Z(n.startAngle);
47
+ A.data.forEach((a, c) => {
48
+ const i = a.value / t, d = i * Math.PI * 2;
49
+ x.push({
50
+ data: a,
51
+ index: c,
52
+ color: a.color || n.colors[c % n.colors.length],
53
+ startA: s,
54
+ endA: s + d,
55
+ midA: s + d / 2,
56
+ percent: i,
57
+ hover: !1,
58
+ hoverProgress: 0
59
+ }), s += d;
60
+ });
61
+ }, dt = () => {
62
+ W = 0;
63
+ const t = 800, s = performance.now(), a = (c) => {
64
+ const i = Math.min(1, (c - s) / t);
65
+ W = 1 - Math.pow(1 - i, 3), G(), i < 1 ? X = requestAnimationFrame(a) : (q = !1, X = null);
66
+ };
67
+ X = requestAnimationFrame(a);
68
+ }, tt = (t) => 1 - Math.pow(1 - t, 3), et = (t) => {
69
+ const s = F === 0 ? 16 : t - F;
70
+ F = t;
71
+ const a = s / Ct;
72
+ let c = !1;
73
+ for (const i of x) {
74
+ const d = i.hover ? 1 : 0;
75
+ if (i.hoverProgress === d) continue;
76
+ const e = d > i.hoverProgress ? 1 : -1;
77
+ i.hoverProgress += e * a, (e > 0 && i.hoverProgress >= d || e < 0 && i.hoverProgress <= d) && (i.hoverProgress = d), i.hoverProgress !== d && (c = !0);
78
+ }
79
+ G(), c ? k = requestAnimationFrame(et) : (k = null, F = 0);
80
+ }, ot = () => {
81
+ k == null && (F = 0, k = requestAnimationFrame(et));
82
+ }, S = (t, s) => {
83
+ let a = t.replace("#", "");
84
+ a.length === 3 && (a = a.split("").map((e) => e + e).join(""));
85
+ const c = parseInt(a.slice(0, 2), 16), i = parseInt(a.slice(2, 4), 16), d = parseInt(a.slice(4, 6), 16);
86
+ return `rgba(${c},${i},${d},${s})`;
87
+ }, G = () => {
88
+ if (!L) return;
89
+ const t = L;
90
+ if (t.clearRect(0, 0, C, _), !x.length) return;
91
+ const s = x[0]?.startA ?? 0, a = Math.PI * 2 * W, c = s + a, i = x.map((e) => {
92
+ const l = e.startA, h = Math.min(e.endA, c), f = h > l, g = tt(Math.max(0, Math.min(1, e.hoverProgress))), P = Math.cos(e.midA) * n.hoverDistance * g, M = Math.sin(e.midA) * n.hoverDistance * g;
93
+ return { ...e, startA: l, endA: h, valid: f, ox: P, oy: M, hp: g };
94
+ });
95
+ if (n.showAura) {
96
+ const e = t.createRadialGradient(
97
+ p,
98
+ u + n.depth,
99
+ v * 0.1,
100
+ p,
101
+ u + n.depth,
102
+ v * 1.5
103
+ );
104
+ e.addColorStop(0, "rgba(6,182,212,0.15)"), e.addColorStop(0.4, "rgba(59,130,246,0.08)"), e.addColorStop(0.8, "rgba(139,92,246,0.03)"), e.addColorStop(1, "rgba(0,0,0,0)"), t.beginPath(), t.ellipse(p, u + n.depth, v * 1.5, m * 0.9, 0, 0, Math.PI * 2), t.fillStyle = e, t.fill(), t.strokeStyle = "rgba(56,189,248,0.08)", t.lineWidth = 1;
105
+ for (let l = 3; l >= 1; l--) {
106
+ const h = v * (0.3 + l * 0.25);
107
+ t.beginPath(), t.ellipse(p, u + n.depth, h, h * (m / v), 0, 0, Math.PI * 2), t.stroke();
108
+ }
109
+ }
110
+ const d = Math.PI / 120;
111
+ for (const e of i) {
112
+ if (!e.valid) continue;
113
+ let l = e.startA;
114
+ const h = n.glowColor || e.color;
115
+ for (; l < e.endA; ) {
116
+ const f = Math.min(l + d, e.endA), g = (l + f) / 2;
117
+ if (Math.sin(g) > 0) {
118
+ const P = V(l, e.ox, e.oy), M = V(f, e.ox, e.oy), o = j(f, e.ox, e.oy), y = j(l, e.ox, e.oy);
119
+ t.fillStyle = S(h, n.opacity * 0.4), t.beginPath(), t.moveTo(P.x, P.y), t.lineTo(M.x, M.y), t.lineTo(o.x, o.y), t.lineTo(y.x, y.y), t.closePath(), t.fill(), t.strokeStyle = S(h, 0.7), t.lineWidth = 0.8, t.beginPath(), t.moveTo(y.x, y.y), t.lineTo(o.x, o.y), t.stroke();
120
+ }
121
+ l = f;
122
+ }
123
+ }
124
+ for (const e of i) {
125
+ if (!e.valid) continue;
126
+ const l = [];
127
+ Math.sin(e.startA) > 1e-3 && l.push({ a: e.startA }), Math.sin(e.endA) > 1e-3 && l.push({ a: e.endA });
128
+ const h = n.glowColor || e.color;
129
+ for (const f of l) {
130
+ const g = { x: p + e.ox, y: u + e.oy }, P = { x: g.x, y: g.y + n.depth }, M = V(f.a, e.ox, e.oy), o = j(f.a, e.ox, e.oy);
131
+ t.fillStyle = S(h, n.opacity * 0.5), t.beginPath(), t.moveTo(g.x, g.y), t.lineTo(M.x, M.y), t.lineTo(o.x, o.y), t.lineTo(P.x, P.y), t.closePath(), t.fill(), t.strokeStyle = S(h, 0.8), t.lineWidth = 0.8, t.beginPath(), t.moveTo(M.x, M.y), t.lineTo(o.x, o.y), t.stroke();
132
+ }
133
+ }
134
+ for (const e of i) {
135
+ if (!e.valid) continue;
136
+ const l = n.glowColor || e.color;
137
+ e.hp > 0.01 && (t.save(), t.shadowColor = l, t.shadowBlur = 12 * e.hp, t.beginPath(), t.moveTo(p + e.ox, u + e.oy), t.ellipse(p + e.ox, u + e.oy, v, m, 0, e.startA, e.endA), t.closePath(), t.fillStyle = S(l, 0.08 * e.hp), t.fill(), t.restore()), t.beginPath(), t.moveTo(p + e.ox, u + e.oy), t.ellipse(p + e.ox, u + e.oy, v, m, 0, e.startA, e.endA), t.closePath();
138
+ const h = t.createRadialGradient(
139
+ p + e.ox - v * 0.2,
140
+ u + e.oy - m * 0.2,
141
+ 0,
142
+ p + e.ox,
143
+ u + e.oy,
144
+ v * 1.05
145
+ );
146
+ h.addColorStop(0, S(l, n.opacity * 0.95)), h.addColorStop(0.6, S(l, n.opacity * 0.8)), h.addColorStop(1, S(l, n.opacity * 0.6)), t.fillStyle = h, t.fill(), t.strokeStyle = S(l, 0.95), t.lineWidth = 0.8 + 0.6 * e.hp, t.stroke();
147
+ }
148
+ if (n.showLabel && W >= 0.999) {
149
+ t.font = `${n.labelFontSize}px Arial, sans-serif`, t.textBaseline = "middle";
150
+ const e = [], l = [], h = n.labelFontSize + 6, f = 14, g = 4;
151
+ for (const o of i) {
152
+ if (!o.valid) continue;
153
+ const y = Math.cos(o.midA) >= 0, b = p + o.ox + v * 1.02 * Math.cos(o.midA), r = u + o.oy + m * 1.02 * Math.sin(o.midA), D = u + o.oy + m * 1.18 * Math.sin(o.midA), pt = n.showPercent ? `${o.data.name} ${(o.percent * 100).toFixed(1)}%` : `${o.data.name}`, vt = !n.labelLineColor || n.labelLineColor === "auto" ? n.glowColor || o.color : n.labelLineColor, gt = {
154
+ slice: o,
155
+ text: pt,
156
+ isRight: y,
157
+ anchorX: b,
158
+ anchorY: r,
159
+ targetY: D,
160
+ y: D,
161
+ color: vt
162
+ };
163
+ (y ? l : e).push(gt);
164
+ }
165
+ const P = (o) => {
166
+ if (!o.length) return;
167
+ o.sort((r, D) => r.targetY - D.targetY);
168
+ const y = g + n.labelFontSize / 2, b = _ - g - n.labelFontSize / 2;
169
+ for (let r = 0; r < o.length; r++)
170
+ r === 0 ? o[r].y = Math.max(y, o[r].targetY) : o[r].y = Math.max(o[r].targetY, o[r - 1].y + h);
171
+ if (o[o.length - 1].y > b) {
172
+ o[o.length - 1].y = b;
173
+ for (let r = o.length - 2; r >= 0; r--)
174
+ o[r].y > o[r + 1].y - h && (o[r].y = o[r + 1].y - h);
175
+ }
176
+ for (let r = 0; r < o.length; r++)
177
+ o[r].y < y && (o[r].y = y);
178
+ };
179
+ P(e), P(l), t.lineWidth = n.labelLineWidth;
180
+ const M = [...e, ...l];
181
+ for (const o of M) {
182
+ const y = t.measureText(o.text).width;
183
+ let b;
184
+ if (o.isRight) {
185
+ const r = Math.min(
186
+ Math.max(o.anchorX + 6, o.anchorX + Math.abs(o.targetY - o.y) * 0.2 + 6),
187
+ C - g - y - f
188
+ );
189
+ b = r + f, t.strokeStyle = o.color, t.beginPath(), t.moveTo(o.anchorX, o.anchorY), t.lineTo(r, o.y), t.lineTo(b, o.y), t.stroke(), t.fillStyle = n.textColor, t.textAlign = "left", t.fillText(o.text, b + 2, o.y);
190
+ } else {
191
+ const r = Math.max(
192
+ Math.min(o.anchorX - 6, o.anchorX - Math.abs(o.targetY - o.y) * 0.2 - 6),
193
+ g + y + f
194
+ );
195
+ b = r - f, t.strokeStyle = o.color, t.beginPath(), t.moveTo(o.anchorX, o.anchorY), t.lineTo(r, o.y), t.lineTo(b, o.y), t.stroke(), t.fillStyle = n.textColor, t.textAlign = "right", t.fillText(o.text, b - 2, o.y);
196
+ }
197
+ }
198
+ }
199
+ }, nt = (t, s) => {
200
+ for (let a = 0; a < x.length; a++) {
201
+ const c = x[a], i = tt(Math.max(0, Math.min(1, c.hoverProgress))), d = Math.cos(c.midA) * n.hoverDistance * i, e = Math.sin(c.midA) * n.hoverDistance * i, l = (t - (p + d)) / v, h = (s - (u + e)) / m;
202
+ if (l * l + h * h > 1) continue;
203
+ let f = Math.atan2((s - (u + e)) / m, (t - (p + d)) / v);
204
+ for (; f < c.startA; ) f += Math.PI * 2;
205
+ for (; f > c.startA + Math.PI * 2; ) f -= Math.PI * 2;
206
+ if (f >= c.startA && f <= c.endA) return a;
207
+ }
208
+ return -1;
209
+ }, ft = (t) => {
210
+ if (!w.value) return;
211
+ const s = w.value.getBoundingClientRect(), a = t.clientX - s.left, c = t.clientY - s.top, i = nt(a, c);
212
+ if (i !== $.value && ($.value = i, x.forEach((d, e) => d.hover = e === i), ot()), i >= 0) {
213
+ const d = x[i];
214
+ B.value = !0, I.value = d.data, N.value = d.percent;
215
+ const e = R.value?.clientWidth || 0, l = R.value?.clientHeight || 0, h = Math.min(a + 12, e - 140), f = Math.min(c + 12, l - 60);
216
+ K.value = Math.max(0, h), Q.value = Math.max(0, f);
217
+ } else
218
+ B.value = !1, I.value = null;
219
+ }, ut = () => {
220
+ $.value !== -1 && ($.value = -1, x.forEach((t) => t.hover = !1), ot()), B.value = !1, I.value = null;
221
+ }, at = (t) => {
222
+ if (!w.value) return;
223
+ const s = w.value.getBoundingClientRect(), a = nt(t.clientX - s.left, t.clientY - s.top);
224
+ a >= 0 && ct("slice-click", x[a].data, a);
225
+ };
226
+ return lt(
227
+ () => A.data,
228
+ () => {
229
+ Object.assign(n, O, A.config), q = A.animation, E();
230
+ },
231
+ { deep: !0 }
232
+ ), lt(
233
+ () => A.config,
234
+ () => {
235
+ Object.assign(n, O, A.config), E();
236
+ },
237
+ { deep: !0 }
238
+ ), mt(() => {
239
+ E(), window.addEventListener("resize", E), w.value?.addEventListener("click", at);
240
+ }), xt(() => {
241
+ window.removeEventListener("resize", E), w.value?.removeEventListener("click", at), X && cancelAnimationFrame(X), k && cancelAnimationFrame(k);
242
+ }), (t, s) => (it(), st("div", {
243
+ class: "g-pie3d-container",
244
+ ref_key: "containerRef",
245
+ ref: R
246
+ }, [
247
+ z("canvas", {
248
+ ref_key: "canvasRef",
249
+ ref: w,
250
+ onMousemove: ft,
251
+ onMouseleave: ut
252
+ }, null, 544),
253
+ B.value ? (it(), st("div", {
254
+ key: 0,
255
+ class: "g-pie3d-tooltip",
256
+ style: bt({ left: `${K.value}px`, top: `${Q.value}px` })
257
+ }, [
258
+ At(t.$slots, "tooltip", {
259
+ data: I.value,
260
+ percent: N.value
261
+ }, () => [
262
+ z("div", wt, [
263
+ z("p", St, U(I.value?.name), 1),
264
+ z("p", Tt, U(I.value?.value) + " (" + U((N.value * 100).toFixed(1)) + "%) ", 1)
265
+ ])
266
+ ], !0)
267
+ ], 4)) : Mt("", !0)
268
+ ], 512));
269
+ }
270
+ }), J = /* @__PURE__ */ Pt(_t, [["__scopeId", "data-v-bf418cec"]]);
271
+ J.install = (H) => {
272
+ H.component(J.name, J);
273
+ };
274
+ export {
275
+ J as GPie3D,
276
+ J as default
277
+ };
@@ -0,0 +1 @@
1
+ .g-pie3d-container[data-v-bf418cec]{position:relative;width:100%;height:100%;overflow:hidden}canvas[data-v-bf418cec]{display:block;width:100%;height:100%}.g-pie3d-tooltip[data-v-bf418cec]{position:absolute;pointer-events:none;z-index:10;background:#0a121ed9;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);color:#e2e8f0;padding:8px 12px;border-radius:4px;font-size:12px;min-width:100px;box-shadow:0 4px 20px #22d3ee40;border:1px solid rgba(34,211,238,.5)}.g-pie3d-tooltip__default p[data-v-bf418cec]{margin:0;line-height:1.5}.g-pie3d-tooltip__name[data-v-bf418cec]{font-weight:600}
@@ -0,0 +1 @@
1
+ export {}
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),C=require("../index-B1MYKy3L.js"),B=require("sortablejs"),x=require("../_plugin-vue_export-helper-BHFhmbuH.js"),P={class:"g-table"},$={key:1},z={class:"g-dropdown-link"},T=e.defineComponent({name:"GTable",inheritAttrs:!1,__name:"index",props:{data:{default:()=>[]},pagination:{type:Boolean,default:!1},operationLabel:{default:"操作"},operaWidth:{default:150},dragSort:{type:Boolean,default:!1},dragSortProps:{default:()=>[]}},emits:["update:currentPage","update:pageSize","sorted:data"],setup(p,{emit:v}){const d=p,c=v,S=t=>{c("update:pageSize",t)},y=t=>{c("update:currentPage",t)},k=e.useSlots(),_=t=>!!k[t],u=e.useAttrs(),N=t=>{const n=!!u["page-size"],o=!!u["current-page"];if(n&&o){const r=Number(u["page-size"]||10),l=Number(u["current-page"]||1);return t+1+r*(l-1)}return t},g=e.ref(null);let m=e.ref(null);const V=()=>{if(g.value)try{const t=g.value.$el.querySelectorAll("tbody");let n=null;for(let o=0;o<t.length;o++){const r=t[o];if(r.querySelectorAll("tr").length>0){n=r;break}}if(!n){console.error("未找到包含数据行的 tbody 元素");return}m.value&&m.value?.destroy?.(),m.value=new B(n,{draggable:"tr",handle:".g-drag-icon",animation:200,ghostClass:"g-sortable-ghost",forceFallback:!0,onStart:function(o){o.item.classList.add("dragging")},onEnd:async function(o){o.item.classList.remove("dragging");const{oldIndex:r,newIndex:l}=o;if(r===void 0||l===void 0){console.error("无效的索引值");return}const s=[...d.data],[f]=s.splice(r,1);if(s.splice(l,0,f),d.dragSortProps.length===0){c("sorted:data",s);return}if(d.dragSortProps.length>0){const h=s.map(a=>{const b={};return d.dragSortProps.forEach(w=>{b[w]=a[w]}),b});c("sorted:data",h)}}})}catch(t){console.error("初始化拖拽排序失败:",t)}};return e.onMounted(()=>{d.dragSort&&setTimeout(()=>{V()},2e3)}),(t,n)=>{const o=e.resolveComponent("el-icon"),r=e.resolveComponent("el-table-column"),l=e.resolveComponent("el-dropdown-menu"),s=e.resolveComponent("el-dropdown"),f=e.resolveComponent("el-table"),h=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("div",null,[e.renderSlot(t.$slots,"action",{},void 0,!0)]),e.createVNode(f,e.mergeProps({data:t.data||[]},t.$attrs,{stripe:"",ref_key:"tableRef",ref:g}),{empty:e.withCtx(()=>[t.$slots.empty?e.renderSlot(t.$slots,"empty",{key:0},void 0,!0):(e.openBlock(),e.createElementBlock("span",$,"暂无数据"))]),default:e.withCtx(()=>[t.dragSort?(e.openBlock(),e.createBlock(r,{key:0,label:"序号",width:"65"},{default:e.withCtx(a=>[e.createElementVNode("div",null,[e.createTextVNode(e.toDisplayString(N(a.$index))+" ",1),e.createVNode(o,{class:"g-drag-icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(C.operation_default))]),_:1})])]),_:1})):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},void 0,!0),_("operations")?(e.openBlock(),e.createBlock(r,{key:1,fixed:"right",label:t.operationLabel||"操作",width:t.operaWidth},{default:e.withCtx(a=>[e.renderSlot(t.$slots,"operations",{row:a.row,index:a.$index},void 0,!0),_("more")?(e.openBlock(),e.createBlock(s,{key:0,size:"small",style:{"vertical-align":"baseline"}},{dropdown:e.withCtx(()=>[e.createVNode(l,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"more",{row:a.row,index:a.$index},void 0,!0)]),_:2},1024)]),default:e.withCtx(()=>[e.createElementVNode("span",z,[n[0]||(n[0]=e.createTextVNode(" 更多 ")),e.createVNode(o,null,{default:e.withCtx(()=>[e.createVNode(e.unref(C.arrow_down_default))]),_:1})])]),_:2},1024)):e.createCommentVNode("",!0)]),_:3},8,["label","width"])):e.createCommentVNode("",!0)]),_:3},16,["data"]),t.pagination?(e.openBlock(),e.createBlock(h,e.mergeProps({key:0,class:"g-pagination-contianer"},t.$attrs,{"page-sizes":[10,20,50,100],layout:"total, sizes, prev, pager, next",onSizeChange:S,onCurrentChange:y}),null,16)):e.createCommentVNode("",!0)])}}}),i=x._export_sfc(T,[["__scopeId","data-v-fcce2277"]]);i.install=p=>{p.component(i.name,i)};exports.GTable=i;exports.default=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),b=require("../index-B1MYKy3L.js"),V=require("sortablejs"),B=require("../_plugin-vue_export-helper-BHFhmbuH.js"),P={class:"g-table"},$={key:1},T={class:"g-dropdown-link"},x=e.defineComponent({name:"GTable",inheritAttrs:!1,__name:"index",props:{data:{default:()=>[]},pagination:{type:Boolean,default:!1},operationLabel:{default:"操作"},operaWidth:{default:150},dragSort:{type:Boolean,default:!1},dragSortProps:{default:()=>[]},currentPage:{default:1},pageSize:{default:10},total:{default:0},pageSizes:{default:()=>[10,20,50,100]},layout:{default:"total, sizes, prev, pager, next"}},emits:["update:currentPage","update:pageSize","sorted:data"],setup(f,{emit:y}){const d=f,u=y,C=t=>{u("update:pageSize",t)},v=t=>{u("update:currentPage",t)},k=e.useSlots(),S=t=>!!k[t],c=e.useAttrs(),z=t=>{const o=!!c["page-size"],a=!!c["current-page"];if(o&&a){const r=Number(c["page-size"]||10),n=Number(c["current-page"]||1);return t+1+r*(n-1)}return t},p=e.ref(null),g=e.shallowRef(null),N=(t=20)=>new Promise(o=>{let a=0;const r=()=>{if(!p.value){o(null);return}const n=p.value.$el.querySelectorAll("tbody");for(let s=0;s<n.length;s++)if(n[s].querySelectorAll("tr").length>0){o(n[s]);return}if(++a>=t){o(null);return}setTimeout(r,500)};r()}),_=async()=>{if(p.value)try{const t=await N();if(!t){console.error("未找到包含数据行的 tbody 元素");return}g.value?.destroy?.(),g.value=new V(t,{draggable:"tr",handle:".g-drag-icon",animation:200,ghostClass:"g-sortable-ghost",forceFallback:!0,onStart:function(o){o.item.classList.add("dragging")},onEnd:async function(o){o.item.classList.remove("dragging");const{oldIndex:a,newIndex:r}=o;if(a===void 0||r===void 0){console.error("无效的索引值");return}const n=[...d.data],[s]=n.splice(a,1);if(n.splice(r,0,s),d.dragSortProps.length===0){u("sorted:data",n);return}if(d.dragSortProps.length>0){const m=n.map(h=>{const l={};return d.dragSortProps.forEach(w=>{l[w]=h[w]}),l});u("sorted:data",m)}}})}catch(t){console.error("初始化拖拽排序失败:",t)}};return e.onMounted(()=>{d.dragSort&&_()}),e.watch(()=>d.data,()=>{d.dragSort&&_()}),e.onBeforeUnmount(()=>{g.value?.destroy?.(),g.value=null}),(t,o)=>{const a=e.resolveComponent("el-icon"),r=e.resolveComponent("el-table-column"),n=e.resolveComponent("el-dropdown-menu"),s=e.resolveComponent("el-dropdown"),m=e.resolveComponent("el-table"),h=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("div",null,[e.renderSlot(t.$slots,"action",{},void 0,!0)]),e.createVNode(m,e.mergeProps({data:t.data||[]},t.$attrs,{stripe:"",ref_key:"tableRef",ref:p}),{empty:e.withCtx(()=>[t.$slots.empty?e.renderSlot(t.$slots,"empty",{key:0},void 0,!0):(e.openBlock(),e.createElementBlock("span",$,"暂无数据"))]),default:e.withCtx(()=>[t.dragSort?(e.openBlock(),e.createBlock(r,{key:0,label:"序号",width:"65"},{default:e.withCtx(l=>[e.createElementVNode("div",null,[e.createTextVNode(e.toDisplayString(z(l.$index))+" ",1),e.createVNode(a,{class:"g-drag-icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(b.operation_default))]),_:1})])]),_:1})):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},void 0,!0),S("operations")?(e.openBlock(),e.createBlock(r,{key:1,fixed:"right",label:t.operationLabel||"操作",width:t.operaWidth},{default:e.withCtx(l=>[e.renderSlot(t.$slots,"operations",{row:l.row,index:l.$index},void 0,!0),S("more")?(e.openBlock(),e.createBlock(s,{key:0,size:"small",style:{"vertical-align":"baseline"}},{dropdown:e.withCtx(()=>[e.createVNode(n,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"more",{row:l.row,index:l.$index},void 0,!0)]),_:2},1024)]),default:e.withCtx(()=>[e.createElementVNode("span",T,[o[0]||(o[0]=e.createTextVNode(" 更多 ")),e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(e.unref(b.arrow_down_default))]),_:1})])]),_:2},1024)):e.createCommentVNode("",!0)]),_:3},8,["label","width"])):e.createCommentVNode("",!0)]),_:3},16,["data"]),t.pagination?(e.openBlock(),e.createBlock(h,{key:0,class:"g-pagination-contianer","current-page":t.currentPage,"page-size":t.pageSize,total:t.total,"page-sizes":t.pageSizes,layout:t.layout,onSizeChange:C,onCurrentChange:v},null,8,["current-page","page-size","total","page-sizes","layout"])):e.createCommentVNode("",!0)])}}}),i=B._export_sfc(x,[["__scopeId","data-v-7f6ade49"]]);i.install=f=>{f.component(i.name,i)};exports.GTable=i;exports.default=i;
@@ -1,8 +1,8 @@
1
- import { defineComponent as x, useSlots as G, useAttrs as R, ref as P, onMounted as W, resolveComponent as d, createElementBlock as I, openBlock as i, createElementVNode as v, createVNode as u, createBlock as m, createCommentVNode as _, renderSlot as p, mergeProps as N, withCtx as r, createTextVNode as T, toDisplayString as F, unref as B } from "vue";
2
- import { o as M, d as H } from "../index-Dxw2pU4z.mjs";
3
- import J from "sortablejs";
4
- import { _ as K } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
5
- const O = { class: "g-table" }, Q = { key: 1 }, U = { class: "g-dropdown-link" }, X = /* @__PURE__ */ x({
1
+ import { defineComponent as V, useSlots as R, useAttrs as q, ref as G, shallowRef as W, onMounted as F, watch as M, onBeforeUnmount as U, resolveComponent as i, createElementBlock as $, openBlock as u, createElementVNode as v, createVNode as p, createBlock as y, createCommentVNode as _, renderSlot as c, mergeProps as H, withCtx as l, createTextVNode as T, toDisplayString as J, unref as B } from "vue";
2
+ import { o as K, d as O } from "../index-Dxw2pU4z.mjs";
3
+ import Q from "sortablejs";
4
+ import { _ as X } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
5
+ const Y = { class: "g-table" }, Z = { key: 1 }, j = { class: "g-dropdown-link" }, x = /* @__PURE__ */ V({
6
6
  name: "GTable",
7
7
  inheritAttrs: !1,
8
8
  __name: "index",
@@ -12,40 +12,55 @@ const O = { class: "g-table" }, Q = { key: 1 }, U = { class: "g-dropdown-link" }
12
12
  operationLabel: { default: "操作" },
13
13
  operaWidth: { default: 150 },
14
14
  dragSort: { type: Boolean, default: !1 },
15
- dragSortProps: { default: () => [] }
15
+ dragSortProps: { default: () => [] },
16
+ currentPage: { default: 1 },
17
+ pageSize: { default: 10 },
18
+ total: { default: 0 },
19
+ pageSizes: { default: () => [10, 20, 50, 100] },
20
+ layout: { default: "total, sizes, prev, pager, next" }
16
21
  },
17
22
  emits: ["update:currentPage", "update:pageSize", "sorted:data"],
18
- setup(b, { emit: A }) {
19
- const c = b, g = A, E = (e) => {
23
+ setup(b, { emit: I }) {
24
+ const d = b, g = I, N = (e) => {
20
25
  g("update:pageSize", e);
21
- }, L = (e) => {
26
+ }, A = (e) => {
22
27
  g("update:currentPage", e);
23
- }, V = G(), C = (e) => !!V[e], f = R(), D = (e) => {
24
- const n = !!f["page-size"], t = !!f["current-page"];
25
- if (n && t) {
26
- const o = Number(f["page-size"] || 10), l = Number(f["current-page"] || 1);
27
- return e + 1 + o * (l - 1);
28
+ }, D = R(), k = (e) => !!D[e], f = q(), E = (e) => {
29
+ const t = !!f["page-size"], n = !!f["current-page"];
30
+ if (t && n) {
31
+ const a = Number(f["page-size"] || 10), o = Number(f["current-page"] || 1);
32
+ return e + 1 + a * (o - 1);
28
33
  }
29
34
  return e;
30
- }, h = P(null);
31
- let y = P(null);
32
- const q = () => {
33
- if (h.value)
34
- try {
35
- const e = h.value.$el.querySelectorAll("tbody");
36
- let n = null;
37
- for (let t = 0; t < e.length; t++) {
38
- const o = e[t];
39
- if (o.querySelectorAll("tr").length > 0) {
40
- n = o;
41
- break;
42
- }
35
+ }, m = G(null), h = W(null), L = (e = 20) => new Promise((t) => {
36
+ let n = 0;
37
+ const a = () => {
38
+ if (!m.value) {
39
+ t(null);
40
+ return;
41
+ }
42
+ const o = m.value.$el.querySelectorAll("tbody");
43
+ for (let s = 0; s < o.length; s++)
44
+ if (o[s].querySelectorAll("tr").length > 0) {
45
+ t(o[s]);
46
+ return;
43
47
  }
44
- if (!n) {
48
+ if (++n >= e) {
49
+ t(null);
50
+ return;
51
+ }
52
+ setTimeout(a, 500);
53
+ };
54
+ a();
55
+ }), C = async () => {
56
+ if (m.value)
57
+ try {
58
+ const e = await L();
59
+ if (!e) {
45
60
  console.error("未找到包含数据行的 tbody 元素");
46
61
  return;
47
62
  }
48
- y.value && y.value?.destroy?.(), y.value = new J(n, {
63
+ h.value?.destroy?.(), h.value = new Q(e, {
49
64
  // 拖拽的元素选择器
50
65
  draggable: "tr",
51
66
  // 拖拽的触发元素选择器
@@ -61,24 +76,24 @@ const O = { class: "g-table" }, Q = { key: 1 }, U = { class: "g-dropdown-link" }
61
76
  },
62
77
  onEnd: async function(t) {
63
78
  t.item.classList.remove("dragging");
64
- const { oldIndex: o, newIndex: l } = t;
65
- if (o === void 0 || l === void 0) {
79
+ const { oldIndex: n, newIndex: a } = t;
80
+ if (n === void 0 || a === void 0) {
66
81
  console.error("无效的索引值");
67
82
  return;
68
83
  }
69
- const s = [...c.data], [S] = s.splice(o, 1);
70
- if (s.splice(l, 0, S), c.dragSortProps.length === 0) {
71
- g("sorted:data", s);
84
+ const o = [...d.data], [s] = o.splice(n, 1);
85
+ if (o.splice(a, 0, s), d.dragSortProps.length === 0) {
86
+ g("sorted:data", o);
72
87
  return;
73
88
  }
74
- if (c.dragSortProps.length > 0) {
75
- const w = s.map((a) => {
76
- const $ = {};
77
- return c.dragSortProps.forEach((z) => {
78
- $[z] = a[z];
79
- }), $;
89
+ if (d.dragSortProps.length > 0) {
90
+ const S = o.map((w) => {
91
+ const r = {};
92
+ return d.dragSortProps.forEach((P) => {
93
+ r[P] = w[P];
94
+ }), r;
80
95
  });
81
- g("sorted:data", w);
96
+ g("sorted:data", S);
82
97
  }
83
98
  }
84
99
  });
@@ -86,38 +101,40 @@ const O = { class: "g-table" }, Q = { key: 1 }, U = { class: "g-dropdown-link" }
86
101
  console.error("初始化拖拽排序失败:", e);
87
102
  }
88
103
  };
89
- return W(() => {
90
- c.dragSort && setTimeout(() => {
91
- q();
92
- }, 2e3);
93
- }), (e, n) => {
94
- const t = d("el-icon"), o = d("el-table-column"), l = d("el-dropdown-menu"), s = d("el-dropdown"), S = d("el-table"), w = d("el-pagination");
95
- return i(), I("div", O, [
104
+ return F(() => {
105
+ d.dragSort && C();
106
+ }), M(() => d.data, () => {
107
+ d.dragSort && C();
108
+ }), U(() => {
109
+ h.value?.destroy?.(), h.value = null;
110
+ }), (e, t) => {
111
+ const n = i("el-icon"), a = i("el-table-column"), o = i("el-dropdown-menu"), s = i("el-dropdown"), S = i("el-table"), w = i("el-pagination");
112
+ return u(), $("div", Y, [
96
113
  v("div", null, [
97
- p(e.$slots, "action", {}, void 0, !0)
114
+ c(e.$slots, "action", {}, void 0, !0)
98
115
  ]),
99
- u(S, N({
116
+ p(S, H({
100
117
  data: e.data || []
101
118
  }, e.$attrs, {
102
119
  stripe: "",
103
120
  ref_key: "tableRef",
104
- ref: h
121
+ ref: m
105
122
  }), {
106
- empty: r(() => [
107
- e.$slots.empty ? p(e.$slots, "empty", { key: 0 }, void 0, !0) : (i(), I("span", Q, "暂无数据"))
123
+ empty: l(() => [
124
+ e.$slots.empty ? c(e.$slots, "empty", { key: 0 }, void 0, !0) : (u(), $("span", Z, "暂无数据"))
108
125
  ]),
109
- default: r(() => [
110
- e.dragSort ? (i(), m(o, {
126
+ default: l(() => [
127
+ e.dragSort ? (u(), y(a, {
111
128
  key: 0,
112
129
  label: "序号",
113
130
  width: "65"
114
131
  }, {
115
- default: r((a) => [
132
+ default: l((r) => [
116
133
  v("div", null, [
117
- T(F(D(a.$index)) + " ", 1),
118
- u(t, { class: "g-drag-icon" }, {
119
- default: r(() => [
120
- u(B(M))
134
+ T(J(E(r.$index)) + " ", 1),
135
+ p(n, { class: "g-drag-icon" }, {
136
+ default: l(() => [
137
+ p(B(K))
121
138
  ]),
122
139
  _: 1
123
140
  })
@@ -125,40 +142,40 @@ const O = { class: "g-table" }, Q = { key: 1 }, U = { class: "g-dropdown-link" }
125
142
  ]),
126
143
  _: 1
127
144
  })) : _("", !0),
128
- p(e.$slots, "default", {}, void 0, !0),
129
- C("operations") ? (i(), m(o, {
145
+ c(e.$slots, "default", {}, void 0, !0),
146
+ k("operations") ? (u(), y(a, {
130
147
  key: 1,
131
148
  fixed: "right",
132
149
  label: e.operationLabel || "操作",
133
150
  width: e.operaWidth
134
151
  }, {
135
- default: r((a) => [
136
- p(e.$slots, "operations", {
137
- row: a.row,
138
- index: a.$index
152
+ default: l((r) => [
153
+ c(e.$slots, "operations", {
154
+ row: r.row,
155
+ index: r.$index
139
156
  }, void 0, !0),
140
- C("more") ? (i(), m(s, {
157
+ k("more") ? (u(), y(s, {
141
158
  key: 0,
142
159
  size: "small",
143
160
  style: { "vertical-align": "baseline" }
144
161
  }, {
145
- dropdown: r(() => [
146
- u(l, null, {
147
- default: r(() => [
148
- p(e.$slots, "more", {
149
- row: a.row,
150
- index: a.$index
162
+ dropdown: l(() => [
163
+ p(o, null, {
164
+ default: l(() => [
165
+ c(e.$slots, "more", {
166
+ row: r.row,
167
+ index: r.$index
151
168
  }, void 0, !0)
152
169
  ]),
153
170
  _: 2
154
171
  }, 1024)
155
172
  ]),
156
- default: r(() => [
157
- v("span", U, [
158
- n[0] || (n[0] = T(" 更多 ")),
159
- u(t, null, {
160
- default: r(() => [
161
- u(B(H))
173
+ default: l(() => [
174
+ v("span", j, [
175
+ t[0] || (t[0] = T(" 更多 ")),
176
+ p(n, null, {
177
+ default: l(() => [
178
+ p(B(O))
162
179
  ]),
163
180
  _: 1
164
181
  })
@@ -172,23 +189,25 @@ const O = { class: "g-table" }, Q = { key: 1 }, U = { class: "g-dropdown-link" }
172
189
  ]),
173
190
  _: 3
174
191
  }, 16, ["data"]),
175
- e.pagination ? (i(), m(w, N({
192
+ e.pagination ? (u(), y(w, {
176
193
  key: 0,
177
- class: "g-pagination-contianer"
178
- }, e.$attrs, {
179
- "page-sizes": [10, 20, 50, 100],
180
- layout: "total, sizes, prev, pager, next",
181
- onSizeChange: E,
182
- onCurrentChange: L
183
- }), null, 16)) : _("", !0)
194
+ class: "g-pagination-contianer",
195
+ "current-page": e.currentPage,
196
+ "page-size": e.pageSize,
197
+ total: e.total,
198
+ "page-sizes": e.pageSizes,
199
+ layout: e.layout,
200
+ onSizeChange: N,
201
+ onCurrentChange: A
202
+ }, null, 8, ["current-page", "page-size", "total", "page-sizes", "layout"])) : _("", !0)
184
203
  ]);
185
204
  };
186
205
  }
187
- }), k = /* @__PURE__ */ K(X, [["__scopeId", "data-v-fcce2277"]]);
188
- k.install = (b) => {
189
- b.component(k.name, k);
206
+ }), z = /* @__PURE__ */ X(x, [["__scopeId", "data-v-7f6ade49"]]);
207
+ z.install = (b) => {
208
+ b.component(z.name, z);
190
209
  };
191
210
  export {
192
- k as GTable,
193
- k as default
211
+ z as GTable,
212
+ z as default
194
213
  };
@@ -1 +1 @@
1
- @charset "UTF-8";.g-table[data-v-fcce2277]{width:100%}.g-table .g-dropdown-link[data-v-fcce2277]{cursor:pointer;color:var(--el-color-primary);display:flex;align-items:center;padding:2px;font-size:12px;margin-left:12px;outline:none;border:none}.g-table .g-dropdown-link[data-v-fcce2277]:hover{color:var(--el-color-primary-light-5);outline:none;border:none}.g-table .g-dropdown-link[data-v-fcce2277]:focus{outline:none;border:none}.g-table[data-v-fcce2277] .el-dropdown-menu__item,.g-table[data-v-fcce2277] .el-dropdown-menu__item:hover{outline:none;border:none}.g-table .g-pagination-contianer[data-v-fcce2277]{margin-top:10px}.g-table .g-drag-icon[data-v-fcce2277]{color:#909399;font-size:18px;transition:color .2s;cursor:move;position:absolute;top:12px}.g-table .g-drag-icon[data-v-fcce2277]:hover{color:var(--el-color-primary)}
1
+ @charset "UTF-8";.g-table[data-v-7f6ade49]{width:100%}.g-table .g-dropdown-link[data-v-7f6ade49]{cursor:pointer;color:var(--el-color-primary);display:flex;align-items:center;padding:2px;font-size:12px;margin-left:12px;outline:none;border:none}.g-table .g-dropdown-link[data-v-7f6ade49]:hover{color:var(--el-color-primary-light-5);outline:none;border:none}.g-table .g-dropdown-link[data-v-7f6ade49]:focus{outline:none;border:none}.g-table[data-v-7f6ade49] .el-dropdown-menu__item,.g-table[data-v-7f6ade49] .el-dropdown-menu__item:hover{outline:none;border:none}.g-table .g-pagination-contianer[data-v-7f6ade49]{margin-top:10px}.g-table .g-drag-icon[data-v-7f6ade49]{color:#909399;font-size:18px;transition:color .2s;cursor:move;position:absolute;top:12px}.g-table .g-drag-icon[data-v-7f6ade49]:hover{color:var(--el-color-primary)}
@@ -0,0 +1,134 @@
1
+ interface PieDatum {
2
+ name: string;
3
+ value: number;
4
+ color?: string;
5
+ [key: string]: any;
6
+ }
7
+ interface Props {
8
+ /**
9
+ * @description 数据项数组
10
+ * @version 0.3.0
11
+ * @default []
12
+ */
13
+ data?: PieDatum[];
14
+ /**
15
+ * @description 自定义样式配置
16
+ * @version 0.3.0
17
+ */
18
+ config?: {
19
+ /** 视角倾斜角度 (单位 deg, 取值 0 ~ 80, 越大越扁平) */
20
+ alpha?: number;
21
+ /** 饼图厚度 (单位 px) */
22
+ depth?: number;
23
+ /** 起始角度 (单位 deg, 0 表示 12 点方向, 顺时针为正) */
24
+ startAngle?: number;
25
+ /** 颜色数组 (优先于数据项内 color) */
26
+ colors?: string[];
27
+ /** 文字颜色 */
28
+ textColor?: string;
29
+ /** 半径占容器最短边的比例 (取值 0 ~ 1) */
30
+ radiusRatio?: number;
31
+ /** hover 时扇区向外推出的距离 (单位 px) */
32
+ hoverDistance?: number;
33
+ /** 是否显示外部标签 */
34
+ showLabel?: boolean;
35
+ /** 是否显示百分比 */
36
+ showPercent?: boolean;
37
+ /** 标签文字大小 */
38
+ labelFontSize?: number;
39
+ /** 顶面填充透明度 (0 ~ 1), 越小越通透; 科技感风格建议 0.5 ~ 0.8 */
40
+ opacity?: number;
41
+ /** 是否绘制底部光圈/网格装饰 */
42
+ showAura?: boolean;
43
+ /** 描边/发光主色 (默认与扇区色一致, 留空则用扇区色高亮) */
44
+ glowColor?: string;
45
+ /**
46
+ * 标签折线颜色
47
+ * - 留空 / 'auto': 使用扇区颜色
48
+ * - 字符串: 统一颜色, 例如 '#94a3b8' / 'rgba(0,0,0,0.4)'
49
+ */
50
+ labelLineColor?: string;
51
+ /** 标签折线宽度 (px), 默认 1 */
52
+ labelLineWidth?: number;
53
+ };
54
+ /**
55
+ * @description 是否启用进入动画
56
+ * @version 0.3.0
57
+ * @default true
58
+ */
59
+ animation?: boolean;
60
+ }
61
+ declare function __VLS_template(): {
62
+ attrs: Partial<{}>;
63
+ slots: {
64
+ tooltip?(_: {
65
+ data: {
66
+ [x: string]: any;
67
+ name: string;
68
+ value: number;
69
+ color?: string | undefined;
70
+ } | null;
71
+ percent: number;
72
+ }): any;
73
+ };
74
+ refs: {
75
+ containerRef: HTMLDivElement;
76
+ canvasRef: HTMLCanvasElement;
77
+ };
78
+ rootEl: HTMLDivElement;
79
+ };
80
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
81
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
82
+ "slice-click": (data: PieDatum, index: number) => any;
83
+ }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
84
+ "onSlice-click"?: ((data: PieDatum, index: number) => any) | undefined;
85
+ }>, {
86
+ data: PieDatum[];
87
+ config: {
88
+ /** 视角倾斜角度 (单位 deg, 取值 0 ~ 80, 越大越扁平) */
89
+ alpha?: number;
90
+ /** 饼图厚度 (单位 px) */
91
+ depth?: number;
92
+ /** 起始角度 (单位 deg, 0 表示 12 点方向, 顺时针为正) */
93
+ startAngle?: number;
94
+ /** 颜色数组 (优先于数据项内 color) */
95
+ colors?: string[];
96
+ /** 文字颜色 */
97
+ textColor?: string;
98
+ /** 半径占容器最短边的比例 (取值 0 ~ 1) */
99
+ radiusRatio?: number;
100
+ /** hover 时扇区向外推出的距离 (单位 px) */
101
+ hoverDistance?: number;
102
+ /** 是否显示外部标签 */
103
+ showLabel?: boolean;
104
+ /** 是否显示百分比 */
105
+ showPercent?: boolean;
106
+ /** 标签文字大小 */
107
+ labelFontSize?: number;
108
+ /** 顶面填充透明度 (0 ~ 1), 越小越通透; 科技感风格建议 0.5 ~ 0.8 */
109
+ opacity?: number;
110
+ /** 是否绘制底部光圈/网格装饰 */
111
+ showAura?: boolean;
112
+ /** 描边/发光主色 (默认与扇区色一致, 留空则用扇区色高亮) */
113
+ glowColor?: string;
114
+ /**
115
+ * 标签折线颜色
116
+ * - 留空 / 'auto': 使用扇区颜色
117
+ * - 字符串: 统一颜色, 例如 '#94a3b8' / 'rgba(0,0,0,0.4)'
118
+ */
119
+ labelLineColor?: string;
120
+ /** 标签折线宽度 (px), 默认 1 */
121
+ labelLineWidth?: number;
122
+ };
123
+ animation: boolean;
124
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
125
+ containerRef: HTMLDivElement;
126
+ canvasRef: HTMLCanvasElement;
127
+ }, HTMLDivElement>;
128
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
129
+ export default _default;
130
+ type __VLS_WithTemplateSlots<T, S> = T & {
131
+ new (): {
132
+ $slots: S;
133
+ };
134
+ };
@@ -1,7 +1,7 @@
1
- import { default as GScreen } from './index';
2
- export default GScreen;
3
- export { GScreen };
4
-
1
+ import { Ref } from 'vue';
2
+ interface Props {
3
+ /**
4
+ * @description 设计稿宽度
5
5
  * @version 0.1.8
6
6
  * @default 1920
7
7
  */
@@ -35,6 +35,36 @@ interface Props {
35
35
  * @default []
36
36
  */
37
37
  dragSortProps?: string[];
38
+ /**
39
+ * @description 当前页码(分页)
40
+ * @version 0.1.5
41
+ * @default 1
42
+ */
43
+ currentPage?: number;
44
+ /**
45
+ * @description 每页条数(分页)
46
+ * @version 0.1.5
47
+ * @default 10
48
+ */
49
+ pageSize?: number;
50
+ /**
51
+ * @description 数据总条数(分页)
52
+ * @version 0.1.5
53
+ * @default 0
54
+ */
55
+ total?: number;
56
+ /**
57
+ * @description 每页条数下拉选项(分页)
58
+ * @version 0.1.5
59
+ * @default [10, 20, 50, 100]
60
+ */
61
+ pageSizes?: number[];
62
+ /**
63
+ * @description 分页布局
64
+ * @version 0.1.5
65
+ * @default 'total, sizes, prev, pager, next'
66
+ */
67
+ layout?: string;
38
68
  }
39
69
  declare function __VLS_template(): {
40
70
  attrs: Partial<{}>;
@@ -72,6 +102,11 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
72
102
  operaWidth: number;
73
103
  dragSort: boolean;
74
104
  dragSortProps: string[];
105
+ currentPage: number;
106
+ pageSize: number;
107
+ total: number;
108
+ pageSizes: number[];
109
+ layout: string;
75
110
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
76
111
  tableRef: unknown;
77
112
  }, any>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../GCount/index.js"),o=require("../GDialog/index.js"),l=require("../GTable/index.js"),n=require("../GVideo/index.js"),r=require("../GBubble/index.js"),a=require("../GProgress/index.js"),d=require("../GScreen/index.js"),i=require("../GPluginVideo/index.js"),t={GCount:u.default,GDialog:o.default,GTable:l.default,GVideo:n.default,GBubble:r.default,GProgress:a.default,GScreen:d.default,GPluginVideo:i.default},c=s=>{Object.keys(t).forEach(G=>{const e=t[G];s.component(e.name,e)})},f={install:c};exports.GCount=u.default;exports.GDialog=o.default;exports.GTable=l.default;exports.GVideo=n.default;exports.GBubble=r.default;exports.GProgress=a.default;exports.GScreen=d.default;exports.GPluginVideo=i.default;exports.default=f;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../GCount/index.js"),o=require("../GDialog/index.js"),l=require("../GTable/index.js"),n=require("../GVideo/index.js"),r=require("../GBubble/index.js"),a=require("../GProgress/index.js"),i=require("../GScreen/index.js"),d=require("../GPluginVideo/index.js"),G=require("../GPie3D/index.js"),t={GCount:u.default,GDialog:o.default,GTable:l.default,GVideo:n.default,GBubble:r.default,GProgress:a.default,GScreen:i.default,GPluginVideo:d.default,GPie3D:G.default},f=s=>{Object.keys(t).forEach(c=>{const e=t[c];s.component(e.name,e)})},b={install:f};exports.GCount=u.default;exports.GDialog=o.default;exports.GTable=l.default;exports.GVideo=n.default;exports.GBubble=r.default;exports.GProgress=a.default;exports.GScreen=i.default;exports.GPluginVideo=d.default;exports.GPie3D=G.default;exports.default=b;
@@ -1,34 +1,37 @@
1
1
  import t from "../GCount/index.mjs";
2
- import e from "../GDialog/index.mjs";
3
- import i from "../GTable/index.mjs";
2
+ import i from "../GDialog/index.mjs";
3
+ import e from "../GTable/index.mjs";
4
4
  import s from "../GVideo/index.mjs";
5
5
  import c from "../GBubble/index.mjs";
6
- import a from "../GProgress/index.mjs";
7
- import f from "../GScreen/index.mjs";
6
+ import f from "../GProgress/index.mjs";
7
+ import a from "../GScreen/index.mjs";
8
8
  import p from "../GPluginVideo/index.mjs";
9
+ import G from "../GPie3D/index.mjs";
9
10
  const m = {
10
11
  GCount: t,
11
- GDialog: e,
12
- GTable: i,
12
+ GDialog: i,
13
+ GTable: e,
13
14
  GVideo: s,
14
15
  GBubble: c,
15
- GProgress: a,
16
- GScreen: f,
17
- GPluginVideo: p
18
- }, G = (n) => {
19
- Object.keys(m).forEach((r) => {
20
- const o = m[r];
21
- n.component(o.name, o);
16
+ GProgress: f,
17
+ GScreen: a,
18
+ GPluginVideo: p,
19
+ GPie3D: G
20
+ }, l = (r) => {
21
+ Object.keys(m).forEach((n) => {
22
+ const o = m[n];
23
+ r.component(o.name, o);
22
24
  });
23
- }, x = { install: G };
25
+ }, D = { install: l };
24
26
  export {
25
27
  c as GBubble,
26
28
  t as GCount,
27
- e as GDialog,
29
+ i as GDialog,
30
+ G as GPie3D,
28
31
  p as GPluginVideo,
29
- a as GProgress,
30
- f as GScreen,
31
- i as GTable,
32
+ f as GProgress,
33
+ a as GScreen,
34
+ e as GTable,
32
35
  s as GVideo,
33
- x as default
36
+ D as default
34
37
  };
package/lib/index.d.ts CHANGED
@@ -6,8 +6,9 @@ import { GBubble } from './components/GBubble';
6
6
  import { GProgress } from './components/GProgress';
7
7
  import { GScreen } from './components/GScreen';
8
8
  import { GPluginVideo } from './components/GPluginVideo';
9
+ import { GPie3D } from './components/GPie3D';
9
10
  declare const _default: {
10
11
  install: (app: any) => void;
11
12
  };
12
13
  export default _default;
13
- export { GCount, GDialog, GTable, GVideo, GBubble, GProgress, GScreen, GPluginVideo };
14
+ export { GCount, GDialog, GTable, GVideo, GBubble, GProgress, GScreen, GPluginVideo, GPie3D };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geekin-devtoys",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "author": "leon",
5
5
  "license": "MIT",
6
6
  "description": "geekin-devtoys组件库",
@@ -88,6 +88,14 @@
88
88
  "import": "./lib/GDialog/style.css",
89
89
  "require": "./lib/GDialog/style.css"
90
90
  },
91
+ "./GPie3D": {
92
+ "import": "./lib/GPie3D/index.mjs",
93
+ "require": "./lib/GPie3D/index.js"
94
+ },
95
+ "./GPie3D/style": {
96
+ "import": "./lib/GPie3D/style.css",
97
+ "require": "./lib/GPie3D/style.css"
98
+ },
91
99
  "./GPluginVideo": {
92
100
  "import": "./lib/GPluginVideo/index.mjs",
93
101
  "require": "./lib/GPluginVideo/index.js"