geekin-devtoys 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/GPie3D/index.js +1 -0
- package/lib/GPie3D/index.mjs +227 -0
- package/lib/GPie3D.d.ts +1 -0
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +111 -92
- package/lib/GTable/style.css +1 -1
- package/lib/assets/GPie3D.css +1 -0
- package/lib/components/GPie3D/index.d.ts +118 -0
- package/lib/components/GProgress/index.d.ts +4 -5
- package/lib/components/GTable/index.d.ts +35 -0
- package/package.json +9 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),te=require("../_plugin-vue_export-helper-BHFhmbuH.js"),oe={class:"g-pie3d-tooltip__default"},ne={class:"g-pie3d-tooltip__name"},ae={class:"g-pie3d-tooltip__value"},le=s.defineComponent({__name:"index",props:{data:{default:()=>[]},config:{default:()=>({})},animation:{type:Boolean,default:!0}},emits:["slice-click"],setup(F,{emit:U}){const x=F,J=U,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:""},n={...V,...x.config},T=s.ref(null),g=s.ref(null);let k=null,w=0,S=0,C=1,d=0,h=0,u=0,v=0,m=[],B=x.animation?0:1,E=null,z=x.animation;const D=s.ref(-1),$=s.ref(!1),G=s.ref(0),H=s.ref(0),_=s.ref(null),N=s.ref(0),O=e=>e*Math.PI/180,j=(e,i=0,o=0)=>({x:d+i+u*Math.cos(e),y:h+o+v*Math.sin(e)}),q=(e,i=0,o=0)=>({x:d+i+u*Math.cos(e),y:h+o+v*Math.sin(e)+n.depth}),I=()=>{if(!g.value||!T.value)return;const e=T.value,i=g.value;C=window.devicePixelRatio||1,w=e.clientWidth,S=e.clientHeight,i.width=w*C,i.height=S*C,i.style.width=w+"px",i.style.height=S+"px",k=i.getContext("2d"),k&&k.setTransform(C,0,0,C,0,0),d=w/2,h=S/2-n.depth/2;const o=n.showLabel?60:10,c=Math.min(w,S-n.depth-o)/2*n.radiusRatio*1.6;u=Math.max(20,c),v=u*Math.cos(O(n.alpha)),K(),z?Q():L()},K=()=>{m=[];const e=x.data.reduce((o,c)=>o+(c.value||0),0);if(e<=0)return;let i=-Math.PI/2+O(n.startAngle);x.data.forEach((o,c)=>{const r=o.value/e,f=r*Math.PI*2;m.push({data:o,index:c,color:o.color||n.colors[c%n.colors.length],startA:i,endA:i+f,midA:i+f/2,percent:r,hover:!1}),i+=f})},Q=()=>{B=0;const e=800,i=performance.now(),o=c=>{const r=Math.min(1,(c-i)/e);B=1-Math.pow(1-r,3),L(),r<1?E=requestAnimationFrame(o):(z=!1,E=null)};E=requestAnimationFrame(o)},M=(e,i)=>{let o=e.replace("#","");o.length===3&&(o=o.split("").map(t=>t+t).join(""));const c=parseInt(o.slice(0,2),16),r=parseInt(o.slice(2,4),16),f=parseInt(o.slice(4,6),16);return`rgba(${c},${r},${f},${i})`},L=()=>{if(!k)return;const e=k;if(e.clearRect(0,0,w,S),!m.length)return;const i=m[0]?.startA??0,o=Math.PI*2*B,c=i+o,r=m.map(t=>{const a=t.startA,l=Math.min(t.endA,c),p=l>a,y=t.hover?Math.cos(t.midA)*n.hoverDistance:0,A=t.hover?Math.sin(t.midA)*n.hoverDistance:0;return{...t,startA:a,endA:l,valid:p,ox:y,oy:A}});if(n.showAura){const t=e.createRadialGradient(d,h+n.depth,u*.1,d,h+n.depth,u*1.5);t.addColorStop(0,"rgba(6,182,212,0.15)"),t.addColorStop(.4,"rgba(59,130,246,0.08)"),t.addColorStop(.8,"rgba(139,92,246,0.03)"),t.addColorStop(1,"rgba(0,0,0,0)"),e.beginPath(),e.ellipse(d,h+n.depth,u*1.5,v*.9,0,0,Math.PI*2),e.fillStyle=t,e.fill(),e.strokeStyle="rgba(56,189,248,0.08)",e.lineWidth=1;for(let a=3;a>=1;a--){const l=u*(.3+a*.25);e.beginPath(),e.ellipse(d,h+n.depth,l,l*(v/u),0,0,Math.PI*2),e.stroke()}}const f=Math.PI/120;for(const t of r){if(!t.valid)continue;let a=t.startA;const l=n.glowColor||t.color;for(;a<t.endA;){const p=Math.min(a+f,t.endA),y=(a+p)/2;if(Math.sin(y)>0){const A=j(a,t.ox,t.oy),P=j(p,t.ox,t.oy),b=q(p,t.ox,t.oy),W=q(a,t.ox,t.oy);e.fillStyle=M(l,n.opacity*.4),e.beginPath(),e.moveTo(A.x,A.y),e.lineTo(P.x,P.y),e.lineTo(b.x,b.y),e.lineTo(W.x,W.y),e.closePath(),e.fill(),e.strokeStyle=M(l,.7),e.lineWidth=.8,e.beginPath(),e.moveTo(W.x,W.y),e.lineTo(b.x,b.y),e.stroke()}a=p}}for(const t of r){if(!t.valid)continue;const a=[];Math.sin(t.startA)>.001&&a.push({a:t.startA}),Math.sin(t.endA)>.001&&a.push({a:t.endA});const l=n.glowColor||t.color;for(const p of a){const y={x:d+t.ox,y:h+t.oy},A={x:y.x,y:y.y+n.depth},P=j(p.a,t.ox,t.oy),b=q(p.a,t.ox,t.oy);e.fillStyle=M(l,n.opacity*.5),e.beginPath(),e.moveTo(y.x,y.y),e.lineTo(P.x,P.y),e.lineTo(b.x,b.y),e.lineTo(A.x,A.y),e.closePath(),e.fill(),e.strokeStyle=M(l,.8),e.lineWidth=.8,e.beginPath(),e.moveTo(P.x,P.y),e.lineTo(b.x,b.y),e.stroke()}}for(const t of r){if(!t.valid)continue;const a=n.glowColor||t.color;t.hover&&(e.save(),e.shadowColor=a,e.shadowBlur=12,e.beginPath(),e.moveTo(d+t.ox,h+t.oy),e.ellipse(d+t.ox,h+t.oy,u,v,0,t.startA,t.endA),e.closePath(),e.fillStyle=M(a,.08),e.fill(),e.restore()),e.beginPath(),e.moveTo(d+t.ox,h+t.oy),e.ellipse(d+t.ox,h+t.oy,u,v,0,t.startA,t.endA),e.closePath();const l=e.createRadialGradient(d+t.ox-u*.2,h+t.oy-v*.2,0,d+t.ox,h+t.oy,u*1.05);l.addColorStop(0,M(a,n.opacity*.95)),l.addColorStop(.6,M(a,n.opacity*.8)),l.addColorStop(1,M(a,n.opacity*.6)),e.fillStyle=l,e.fill(),e.strokeStyle=M(a,.95),e.lineWidth=t.hover?1.4:.8,e.stroke()}if(n.showLabel&&B>=.999){e.font=`${n.labelFontSize}px Arial, sans-serif`,e.fillStyle=n.textColor,e.strokeStyle="rgba(0,0,0,0.25)",e.lineWidth=1;for(const t of r){if(!t.valid)continue;const a={x:d+t.ox+u*1.02*Math.cos(t.midA),y:h+t.oy+v*1.02*Math.sin(t.midA)},l={x:d+t.ox+u*1.18*Math.cos(t.midA),y:h+t.oy+v*1.18*Math.sin(t.midA)},p=Math.cos(t.midA)>=0,y={x:l.x+(p?14:-14)};e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.lineTo(y.x,l.y),e.stroke(),e.textAlign=p?"left":"right",e.textBaseline="middle";const A=n.showPercent?`${t.data.name} ${(t.percent*100).toFixed(1)}%`:`${t.data.name}`;e.fillText(A,y.x+(p?2:-2),l.y)}}},X=(e,i)=>{for(let o=0;o<m.length;o++){const c=m[o],r=c.hover?Math.cos(c.midA)*n.hoverDistance:0,f=c.hover?Math.sin(c.midA)*n.hoverDistance:0,t=(e-(d+r))/u,a=(i-(h+f))/v;if(t*t+a*a>1)continue;let l=Math.atan2((i-(h+f))/v,(e-(d+r))/u);for(;l<c.startA;)l+=Math.PI*2;for(;l>c.startA+Math.PI*2;)l-=Math.PI*2;if(l>=c.startA&&l<=c.endA)return o}return-1},Z=e=>{if(!g.value)return;const i=g.value.getBoundingClientRect(),o=e.clientX-i.left,c=e.clientY-i.top,r=X(o,c);if(r!==D.value&&(D.value=r,m.forEach((f,t)=>f.hover=t===r),L()),r>=0){const f=m[r];$.value=!0,_.value=f.data,N.value=f.percent;const t=T.value?.clientWidth||0,a=T.value?.clientHeight||0,l=Math.min(o+12,t-140),p=Math.min(c+12,a-60);G.value=Math.max(0,l),H.value=Math.max(0,p)}else $.value=!1,_.value=null},ee=()=>{D.value!==-1&&(D.value=-1,m.forEach(e=>e.hover=!1),L()),$.value=!1,_.value=null},Y=e=>{if(!g.value)return;const i=g.value.getBoundingClientRect(),o=X(e.clientX-i.left,e.clientY-i.top);o>=0&&J("slice-click",m[o].data,o)};return s.watch(()=>x.data,()=>{Object.assign(n,V,x.config),z=x.animation,I()},{deep:!0}),s.watch(()=>x.config,()=>{Object.assign(n,V,x.config),I()},{deep:!0}),s.onMounted(()=>{I(),window.addEventListener("resize",I),g.value?.addEventListener("click",Y)}),s.onUnmounted(()=>{window.removeEventListener("resize",I),g.value?.removeEventListener("click",Y),E&&cancelAnimationFrame(E)}),(e,i)=>(s.openBlock(),s.createElementBlock("div",{class:"g-pie3d-container",ref_key:"containerRef",ref:T},[s.createElementVNode("canvas",{ref_key:"canvasRef",ref:g,onMousemove:Z,onMouseleave:ee},null,544),$.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:"g-pie3d-tooltip",style:s.normalizeStyle({left:`${G.value}px`,top:`${H.value}px`})},[s.renderSlot(e.$slots,"tooltip",{data:_.value,percent:N.value},()=>[s.createElementVNode("div",oe,[s.createElementVNode("p",ne,s.toDisplayString(_.value?.name),1),s.createElementVNode("p",ae,s.toDisplayString(_.value?.value)+" ("+s.toDisplayString((N.value*100).toFixed(1))+"%) ",1)])],!0)],4)):s.createCommentVNode("",!0)],512))}}),R=te._export_sfc(le,[["__scopeId","data-v-f18ddc7e"]]);R.install=F=>{F.component(R.name,R)};exports.GPie3D=R;exports.default=R;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { defineComponent as it, ref as b, watch as K, onMounted as st, onUnmounted as ct, createElementBlock as Q, openBlock as Z, createElementVNode as W, createCommentVNode as rt, normalizeStyle as dt, renderSlot as ht, toDisplayString as X } from "vue";
|
|
2
|
+
import { _ as ut } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
3
|
+
const pt = { class: "g-pie3d-tooltip__default" }, ft = { class: "g-pie3d-tooltip__name" }, vt = { class: "g-pie3d-tooltip__value" }, mt = /* @__PURE__ */ it({
|
|
4
|
+
__name: "index",
|
|
5
|
+
props: {
|
|
6
|
+
data: { default: () => [] },
|
|
7
|
+
config: { default: () => ({}) },
|
|
8
|
+
animation: { type: Boolean, default: !0 }
|
|
9
|
+
},
|
|
10
|
+
emits: ["slice-click"],
|
|
11
|
+
setup(F, { emit: tt }) {
|
|
12
|
+
const x = F, et = tt, z = {
|
|
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
|
+
}, n = { ...z, ...x.config }, T = b(null), y = b(null);
|
|
27
|
+
let C = null, P = 0, S = 0, k = 1, r = 0, d = 0, h = 0, f = 0, v = [], E = x.animation ? 0 : 1, I = null, j = x.animation;
|
|
28
|
+
const $ = b(-1), B = b(!1), q = b(0), N = b(0), _ = b(null), G = b(0), O = (t) => t * Math.PI / 180, H = (t, i = 0, o = 0) => ({
|
|
29
|
+
x: r + i + h * Math.cos(t),
|
|
30
|
+
y: d + o + f * Math.sin(t)
|
|
31
|
+
}), V = (t, i = 0, o = 0) => ({
|
|
32
|
+
x: r + i + h * Math.cos(t),
|
|
33
|
+
y: d + o + f * Math.sin(t) + n.depth
|
|
34
|
+
}), R = () => {
|
|
35
|
+
if (!y.value || !T.value) return;
|
|
36
|
+
const t = T.value, i = y.value;
|
|
37
|
+
k = window.devicePixelRatio || 1, P = t.clientWidth, S = t.clientHeight, i.width = P * k, i.height = S * k, i.style.width = P + "px", i.style.height = S + "px", C = i.getContext("2d"), C && C.setTransform(k, 0, 0, k, 0, 0), r = P / 2, d = S / 2 - n.depth / 2;
|
|
38
|
+
const o = n.showLabel ? 60 : 10, s = Math.min(P, S - n.depth - o) / 2 * n.radiusRatio * 1.6;
|
|
39
|
+
h = Math.max(20, s), f = h * Math.cos(O(n.alpha)), ot(), j ? nt() : D();
|
|
40
|
+
}, ot = () => {
|
|
41
|
+
v = [];
|
|
42
|
+
const t = x.data.reduce((o, s) => o + (s.value || 0), 0);
|
|
43
|
+
if (t <= 0) return;
|
|
44
|
+
let i = -Math.PI / 2 + O(n.startAngle);
|
|
45
|
+
x.data.forEach((o, s) => {
|
|
46
|
+
const c = o.value / t, u = c * Math.PI * 2;
|
|
47
|
+
v.push({
|
|
48
|
+
data: o,
|
|
49
|
+
index: s,
|
|
50
|
+
color: o.color || n.colors[s % n.colors.length],
|
|
51
|
+
startA: i,
|
|
52
|
+
endA: i + u,
|
|
53
|
+
midA: i + u / 2,
|
|
54
|
+
percent: c,
|
|
55
|
+
hover: !1
|
|
56
|
+
}), i += u;
|
|
57
|
+
});
|
|
58
|
+
}, nt = () => {
|
|
59
|
+
E = 0;
|
|
60
|
+
const t = 800, i = performance.now(), o = (s) => {
|
|
61
|
+
const c = Math.min(1, (s - i) / t);
|
|
62
|
+
E = 1 - Math.pow(1 - c, 3), D(), c < 1 ? I = requestAnimationFrame(o) : (j = !1, I = null);
|
|
63
|
+
};
|
|
64
|
+
I = requestAnimationFrame(o);
|
|
65
|
+
}, g = (t, i) => {
|
|
66
|
+
let o = t.replace("#", "");
|
|
67
|
+
o.length === 3 && (o = o.split("").map((e) => e + e).join(""));
|
|
68
|
+
const s = parseInt(o.slice(0, 2), 16), c = parseInt(o.slice(2, 4), 16), u = parseInt(o.slice(4, 6), 16);
|
|
69
|
+
return `rgba(${s},${c},${u},${i})`;
|
|
70
|
+
}, D = () => {
|
|
71
|
+
if (!C) return;
|
|
72
|
+
const t = C;
|
|
73
|
+
if (t.clearRect(0, 0, P, S), !v.length) return;
|
|
74
|
+
const i = v[0]?.startA ?? 0, o = Math.PI * 2 * E, s = i + o, c = v.map((e) => {
|
|
75
|
+
const a = e.startA, l = Math.min(e.endA, s), p = l > a, m = e.hover ? Math.cos(e.midA) * n.hoverDistance : 0, M = e.hover ? Math.sin(e.midA) * n.hoverDistance : 0;
|
|
76
|
+
return { ...e, startA: a, endA: l, valid: p, ox: m, oy: M };
|
|
77
|
+
});
|
|
78
|
+
if (n.showAura) {
|
|
79
|
+
const e = t.createRadialGradient(
|
|
80
|
+
r,
|
|
81
|
+
d + n.depth,
|
|
82
|
+
h * 0.1,
|
|
83
|
+
r,
|
|
84
|
+
d + n.depth,
|
|
85
|
+
h * 1.5
|
|
86
|
+
);
|
|
87
|
+
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(r, d + n.depth, h * 1.5, f * 0.9, 0, 0, Math.PI * 2), t.fillStyle = e, t.fill(), t.strokeStyle = "rgba(56,189,248,0.08)", t.lineWidth = 1;
|
|
88
|
+
for (let a = 3; a >= 1; a--) {
|
|
89
|
+
const l = h * (0.3 + a * 0.25);
|
|
90
|
+
t.beginPath(), t.ellipse(r, d + n.depth, l, l * (f / h), 0, 0, Math.PI * 2), t.stroke();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const u = Math.PI / 120;
|
|
94
|
+
for (const e of c) {
|
|
95
|
+
if (!e.valid) continue;
|
|
96
|
+
let a = e.startA;
|
|
97
|
+
const l = n.glowColor || e.color;
|
|
98
|
+
for (; a < e.endA; ) {
|
|
99
|
+
const p = Math.min(a + u, e.endA), m = (a + p) / 2;
|
|
100
|
+
if (Math.sin(m) > 0) {
|
|
101
|
+
const M = H(a, e.ox, e.oy), w = H(p, e.ox, e.oy), A = V(p, e.ox, e.oy), L = V(a, e.ox, e.oy);
|
|
102
|
+
t.fillStyle = g(l, n.opacity * 0.4), t.beginPath(), t.moveTo(M.x, M.y), t.lineTo(w.x, w.y), t.lineTo(A.x, A.y), t.lineTo(L.x, L.y), t.closePath(), t.fill(), t.strokeStyle = g(l, 0.7), t.lineWidth = 0.8, t.beginPath(), t.moveTo(L.x, L.y), t.lineTo(A.x, A.y), t.stroke();
|
|
103
|
+
}
|
|
104
|
+
a = p;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const e of c) {
|
|
108
|
+
if (!e.valid) continue;
|
|
109
|
+
const a = [];
|
|
110
|
+
Math.sin(e.startA) > 1e-3 && a.push({ a: e.startA }), Math.sin(e.endA) > 1e-3 && a.push({ a: e.endA });
|
|
111
|
+
const l = n.glowColor || e.color;
|
|
112
|
+
for (const p of a) {
|
|
113
|
+
const m = { x: r + e.ox, y: d + e.oy }, M = { x: m.x, y: m.y + n.depth }, w = H(p.a, e.ox, e.oy), A = V(p.a, e.ox, e.oy);
|
|
114
|
+
t.fillStyle = g(l, n.opacity * 0.5), t.beginPath(), t.moveTo(m.x, m.y), t.lineTo(w.x, w.y), t.lineTo(A.x, A.y), t.lineTo(M.x, M.y), t.closePath(), t.fill(), t.strokeStyle = g(l, 0.8), t.lineWidth = 0.8, t.beginPath(), t.moveTo(w.x, w.y), t.lineTo(A.x, A.y), t.stroke();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
for (const e of c) {
|
|
118
|
+
if (!e.valid) continue;
|
|
119
|
+
const a = n.glowColor || e.color;
|
|
120
|
+
e.hover && (t.save(), t.shadowColor = a, t.shadowBlur = 12, t.beginPath(), t.moveTo(r + e.ox, d + e.oy), t.ellipse(r + e.ox, d + e.oy, h, f, 0, e.startA, e.endA), t.closePath(), t.fillStyle = g(a, 0.08), t.fill(), t.restore()), t.beginPath(), t.moveTo(r + e.ox, d + e.oy), t.ellipse(r + e.ox, d + e.oy, h, f, 0, e.startA, e.endA), t.closePath();
|
|
121
|
+
const l = t.createRadialGradient(
|
|
122
|
+
r + e.ox - h * 0.2,
|
|
123
|
+
d + e.oy - f * 0.2,
|
|
124
|
+
0,
|
|
125
|
+
r + e.ox,
|
|
126
|
+
d + e.oy,
|
|
127
|
+
h * 1.05
|
|
128
|
+
);
|
|
129
|
+
l.addColorStop(0, g(a, n.opacity * 0.95)), l.addColorStop(0.6, g(a, n.opacity * 0.8)), l.addColorStop(1, g(a, n.opacity * 0.6)), t.fillStyle = l, t.fill(), t.strokeStyle = g(a, 0.95), t.lineWidth = e.hover ? 1.4 : 0.8, t.stroke();
|
|
130
|
+
}
|
|
131
|
+
if (n.showLabel && E >= 0.999) {
|
|
132
|
+
t.font = `${n.labelFontSize}px Arial, sans-serif`, t.fillStyle = n.textColor, t.strokeStyle = "rgba(0,0,0,0.25)", t.lineWidth = 1;
|
|
133
|
+
for (const e of c) {
|
|
134
|
+
if (!e.valid) continue;
|
|
135
|
+
const a = {
|
|
136
|
+
x: r + e.ox + h * 1.02 * Math.cos(e.midA),
|
|
137
|
+
y: d + e.oy + f * 1.02 * Math.sin(e.midA)
|
|
138
|
+
}, l = {
|
|
139
|
+
x: r + e.ox + h * 1.18 * Math.cos(e.midA),
|
|
140
|
+
y: d + e.oy + f * 1.18 * Math.sin(e.midA)
|
|
141
|
+
}, p = Math.cos(e.midA) >= 0, m = {
|
|
142
|
+
x: l.x + (p ? 14 : -14)
|
|
143
|
+
};
|
|
144
|
+
t.beginPath(), t.moveTo(a.x, a.y), t.lineTo(l.x, l.y), t.lineTo(m.x, l.y), t.stroke(), t.textAlign = p ? "left" : "right", t.textBaseline = "middle";
|
|
145
|
+
const M = n.showPercent ? `${e.data.name} ${(e.percent * 100).toFixed(1)}%` : `${e.data.name}`;
|
|
146
|
+
t.fillText(M, m.x + (p ? 2 : -2), l.y);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, U = (t, i) => {
|
|
150
|
+
for (let o = 0; o < v.length; o++) {
|
|
151
|
+
const s = v[o], c = s.hover ? Math.cos(s.midA) * n.hoverDistance : 0, u = s.hover ? Math.sin(s.midA) * n.hoverDistance : 0, e = (t - (r + c)) / h, a = (i - (d + u)) / f;
|
|
152
|
+
if (e * e + a * a > 1) continue;
|
|
153
|
+
let l = Math.atan2((i - (d + u)) / f, (t - (r + c)) / h);
|
|
154
|
+
for (; l < s.startA; ) l += Math.PI * 2;
|
|
155
|
+
for (; l > s.startA + Math.PI * 2; ) l -= Math.PI * 2;
|
|
156
|
+
if (l >= s.startA && l <= s.endA) return o;
|
|
157
|
+
}
|
|
158
|
+
return -1;
|
|
159
|
+
}, at = (t) => {
|
|
160
|
+
if (!y.value) return;
|
|
161
|
+
const i = y.value.getBoundingClientRect(), o = t.clientX - i.left, s = t.clientY - i.top, c = U(o, s);
|
|
162
|
+
if (c !== $.value && ($.value = c, v.forEach((u, e) => u.hover = e === c), D()), c >= 0) {
|
|
163
|
+
const u = v[c];
|
|
164
|
+
B.value = !0, _.value = u.data, G.value = u.percent;
|
|
165
|
+
const e = T.value?.clientWidth || 0, a = T.value?.clientHeight || 0, l = Math.min(o + 12, e - 140), p = Math.min(s + 12, a - 60);
|
|
166
|
+
q.value = Math.max(0, l), N.value = Math.max(0, p);
|
|
167
|
+
} else
|
|
168
|
+
B.value = !1, _.value = null;
|
|
169
|
+
}, lt = () => {
|
|
170
|
+
$.value !== -1 && ($.value = -1, v.forEach((t) => t.hover = !1), D()), B.value = !1, _.value = null;
|
|
171
|
+
}, J = (t) => {
|
|
172
|
+
if (!y.value) return;
|
|
173
|
+
const i = y.value.getBoundingClientRect(), o = U(t.clientX - i.left, t.clientY - i.top);
|
|
174
|
+
o >= 0 && et("slice-click", v[o].data, o);
|
|
175
|
+
};
|
|
176
|
+
return K(
|
|
177
|
+
() => x.data,
|
|
178
|
+
() => {
|
|
179
|
+
Object.assign(n, z, x.config), j = x.animation, R();
|
|
180
|
+
},
|
|
181
|
+
{ deep: !0 }
|
|
182
|
+
), K(
|
|
183
|
+
() => x.config,
|
|
184
|
+
() => {
|
|
185
|
+
Object.assign(n, z, x.config), R();
|
|
186
|
+
},
|
|
187
|
+
{ deep: !0 }
|
|
188
|
+
), st(() => {
|
|
189
|
+
R(), window.addEventListener("resize", R), y.value?.addEventListener("click", J);
|
|
190
|
+
}), ct(() => {
|
|
191
|
+
window.removeEventListener("resize", R), y.value?.removeEventListener("click", J), I && cancelAnimationFrame(I);
|
|
192
|
+
}), (t, i) => (Z(), Q("div", {
|
|
193
|
+
class: "g-pie3d-container",
|
|
194
|
+
ref_key: "containerRef",
|
|
195
|
+
ref: T
|
|
196
|
+
}, [
|
|
197
|
+
W("canvas", {
|
|
198
|
+
ref_key: "canvasRef",
|
|
199
|
+
ref: y,
|
|
200
|
+
onMousemove: at,
|
|
201
|
+
onMouseleave: lt
|
|
202
|
+
}, null, 544),
|
|
203
|
+
B.value ? (Z(), Q("div", {
|
|
204
|
+
key: 0,
|
|
205
|
+
class: "g-pie3d-tooltip",
|
|
206
|
+
style: dt({ left: `${q.value}px`, top: `${N.value}px` })
|
|
207
|
+
}, [
|
|
208
|
+
ht(t.$slots, "tooltip", {
|
|
209
|
+
data: _.value,
|
|
210
|
+
percent: G.value
|
|
211
|
+
}, () => [
|
|
212
|
+
W("div", pt, [
|
|
213
|
+
W("p", ft, X(_.value?.name), 1),
|
|
214
|
+
W("p", vt, X(_.value?.value) + " (" + X((G.value * 100).toFixed(1)) + "%) ", 1)
|
|
215
|
+
])
|
|
216
|
+
], !0)
|
|
217
|
+
], 4)) : rt("", !0)
|
|
218
|
+
], 512));
|
|
219
|
+
}
|
|
220
|
+
}), Y = /* @__PURE__ */ ut(mt, [["__scopeId", "data-v-f18ddc7e"]]);
|
|
221
|
+
Y.install = (F) => {
|
|
222
|
+
F.component(Y.name, Y);
|
|
223
|
+
};
|
|
224
|
+
export {
|
|
225
|
+
Y as GPie3D,
|
|
226
|
+
Y as default
|
|
227
|
+
};
|
package/lib/GPie3D.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/lib/GTable/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
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;
|
package/lib/GTable/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { o as
|
|
3
|
-
import
|
|
4
|
-
import { _ as
|
|
5
|
-
const
|
|
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:
|
|
19
|
-
const
|
|
23
|
+
setup(b, { emit: I }) {
|
|
24
|
+
const d = b, g = I, N = (e) => {
|
|
20
25
|
g("update:pageSize", e);
|
|
21
|
-
},
|
|
26
|
+
}, A = (e) => {
|
|
22
27
|
g("update:currentPage", e);
|
|
23
|
-
},
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
return e + 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 =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
65
|
-
if (
|
|
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
|
|
70
|
-
if (
|
|
71
|
-
g("sorted:data",
|
|
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 (
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
return
|
|
78
|
-
|
|
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",
|
|
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
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}), (
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
114
|
+
c(e.$slots, "action", {}, void 0, !0)
|
|
98
115
|
]),
|
|
99
|
-
|
|
116
|
+
p(S, H({
|
|
100
117
|
data: e.data || []
|
|
101
118
|
}, e.$attrs, {
|
|
102
119
|
stripe: "",
|
|
103
120
|
ref_key: "tableRef",
|
|
104
|
-
ref:
|
|
121
|
+
ref: m
|
|
105
122
|
}), {
|
|
106
|
-
empty:
|
|
107
|
-
e.$slots.empty ?
|
|
123
|
+
empty: l(() => [
|
|
124
|
+
e.$slots.empty ? c(e.$slots, "empty", { key: 0 }, void 0, !0) : (u(), $("span", Z, "暂无数据"))
|
|
108
125
|
]),
|
|
109
|
-
default:
|
|
110
|
-
e.dragSort ? (
|
|
126
|
+
default: l(() => [
|
|
127
|
+
e.dragSort ? (u(), y(a, {
|
|
111
128
|
key: 0,
|
|
112
129
|
label: "序号",
|
|
113
130
|
width: "65"
|
|
114
131
|
}, {
|
|
115
|
-
default:
|
|
132
|
+
default: l((r) => [
|
|
116
133
|
v("div", null, [
|
|
117
|
-
T(
|
|
118
|
-
|
|
119
|
-
default:
|
|
120
|
-
|
|
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
|
-
|
|
129
|
-
|
|
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:
|
|
136
|
-
|
|
137
|
-
row:
|
|
138
|
-
index:
|
|
152
|
+
default: l((r) => [
|
|
153
|
+
c(e.$slots, "operations", {
|
|
154
|
+
row: r.row,
|
|
155
|
+
index: r.$index
|
|
139
156
|
}, void 0, !0),
|
|
140
|
-
|
|
157
|
+
k("more") ? (u(), y(s, {
|
|
141
158
|
key: 0,
|
|
142
159
|
size: "small",
|
|
143
160
|
style: { "vertical-align": "baseline" }
|
|
144
161
|
}, {
|
|
145
|
-
dropdown:
|
|
146
|
-
|
|
147
|
-
default:
|
|
148
|
-
|
|
149
|
-
row:
|
|
150
|
-
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:
|
|
157
|
-
v("span",
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
default:
|
|
161
|
-
|
|
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 ? (
|
|
192
|
+
e.pagination ? (u(), y(w, {
|
|
176
193
|
key: 0,
|
|
177
|
-
class: "g-pagination-contianer"
|
|
178
|
-
|
|
179
|
-
"page-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
-
}),
|
|
188
|
-
|
|
189
|
-
b.component(
|
|
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
|
-
|
|
193
|
-
|
|
211
|
+
z as GTable,
|
|
212
|
+
z as default
|
|
194
213
|
};
|
package/lib/GTable/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.g-table[data-v-
|
|
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 @@
|
|
|
1
|
+
.g-pie3d-container[data-v-f18ddc7e]{position:relative;width:100%;height:100%;overflow:hidden}canvas[data-v-f18ddc7e]{display:block;width:100%;height:100%}.g-pie3d-tooltip[data-v-f18ddc7e]{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-f18ddc7e]{margin:0;line-height:1.5}.g-pie3d-tooltip__name[data-v-f18ddc7e]{font-weight:600}
|
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
* @description 是否启用进入动画
|
|
48
|
+
* @version 0.3.0
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
animation?: boolean;
|
|
52
|
+
}
|
|
53
|
+
declare function __VLS_template(): {
|
|
54
|
+
attrs: Partial<{}>;
|
|
55
|
+
slots: {
|
|
56
|
+
tooltip?(_: {
|
|
57
|
+
data: {
|
|
58
|
+
[x: string]: any;
|
|
59
|
+
name: string;
|
|
60
|
+
value: number;
|
|
61
|
+
color?: string | undefined;
|
|
62
|
+
} | null;
|
|
63
|
+
percent: number;
|
|
64
|
+
}): any;
|
|
65
|
+
};
|
|
66
|
+
refs: {
|
|
67
|
+
containerRef: HTMLDivElement;
|
|
68
|
+
canvasRef: HTMLCanvasElement;
|
|
69
|
+
};
|
|
70
|
+
rootEl: HTMLDivElement;
|
|
71
|
+
};
|
|
72
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
73
|
+
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
74
|
+
"slice-click": (data: PieDatum, index: number) => any;
|
|
75
|
+
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
|
|
76
|
+
"onSlice-click"?: ((data: PieDatum, index: number) => any) | undefined;
|
|
77
|
+
}>, {
|
|
78
|
+
data: PieDatum[];
|
|
79
|
+
config: {
|
|
80
|
+
/** 视角倾斜角度 (单位 deg, 取值 0 ~ 80, 越大越扁平) */
|
|
81
|
+
alpha?: number;
|
|
82
|
+
/** 饼图厚度 (单位 px) */
|
|
83
|
+
depth?: number;
|
|
84
|
+
/** 起始角度 (单位 deg, 0 表示 12 点方向, 顺时针为正) */
|
|
85
|
+
startAngle?: number;
|
|
86
|
+
/** 颜色数组 (优先于数据项内 color) */
|
|
87
|
+
colors?: string[];
|
|
88
|
+
/** 文字颜色 */
|
|
89
|
+
textColor?: string;
|
|
90
|
+
/** 半径占容器最短边的比例 (取值 0 ~ 1) */
|
|
91
|
+
radiusRatio?: number;
|
|
92
|
+
/** hover 时扇区向外推出的距离 (单位 px) */
|
|
93
|
+
hoverDistance?: number;
|
|
94
|
+
/** 是否显示外部标签 */
|
|
95
|
+
showLabel?: boolean;
|
|
96
|
+
/** 是否显示百分比 */
|
|
97
|
+
showPercent?: boolean;
|
|
98
|
+
/** 标签文字大小 */
|
|
99
|
+
labelFontSize?: number;
|
|
100
|
+
/** 顶面填充透明度 (0 ~ 1), 越小越通透; 科技感风格建议 0.5 ~ 0.8 */
|
|
101
|
+
opacity?: number;
|
|
102
|
+
/** 是否绘制底部光圈/网格装饰 */
|
|
103
|
+
showAura?: boolean;
|
|
104
|
+
/** 描边/发光主色 (默认与扇区色一致, 留空则用扇区色高亮) */
|
|
105
|
+
glowColor?: string;
|
|
106
|
+
};
|
|
107
|
+
animation: boolean;
|
|
108
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
109
|
+
containerRef: HTMLDivElement;
|
|
110
|
+
canvasRef: HTMLCanvasElement;
|
|
111
|
+
}, HTMLDivElement>;
|
|
112
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
113
|
+
export default _default;
|
|
114
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
115
|
+
new (): {
|
|
116
|
+
$slots: S;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
@@ -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>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geekin-devtoys",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
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"
|