ranui 0.1.6 → 0.1.7
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/dist/add-user-b2bed3e7.js +4 -0
- package/dist/book-b11a68eb.js +4 -0
- package/dist/build/config.d.ts +3 -0
- package/dist/check-circle-74bd09c3.js +4 -0
- package/dist/check-circle-fill-dc284144.js +4 -0
- package/dist/close-20925345.js +4 -0
- package/dist/close-circle-720c18be.js +4 -0
- package/dist/close-circle-fill-238a66b1.js +4 -0
- package/dist/components/button/index.js +4 -2
- package/dist/components/icon/index.js +3 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.js +2 -2
- package/dist/components/message/index.d.ts +12 -6
- package/dist/components/message/index.js +1 -2
- package/dist/components/modal/index.js +4 -0
- package/dist/components/option/index.d.ts +2 -0
- package/dist/components/option/index.js +95 -0
- package/dist/components/{video → player}/index.d.ts +198 -87
- package/dist/components/player/index.js +11 -0
- package/dist/components/preview/excel/excel.d.ts +0 -9
- package/dist/components/preview/index.d.ts +4 -0
- package/dist/components/preview/index.js +5 -4
- package/dist/components/progress/index.d.ts +36 -0
- package/dist/components/progress/index.js +8 -0
- package/dist/components/radar/index.js +4 -2
- package/dist/components/select/index.d.ts +101 -0
- package/dist/components/select/index.js +11 -0
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/tab/index.js +4 -2
- package/dist/components/tabpane/index.js +1 -1
- package/dist/docx-c5d02d8c.js +21 -0
- package/dist/eye-5e742329.js +4 -0
- package/dist/eye-close-3874f1ae.js +4 -0
- package/dist/hls/5_1700986031916/5.key +1 -0
- package/dist/hls/5_1700986031916/5.m3u8 +12 -0
- package/dist/hls/5_1700986031916/5_00000.ts +0 -0
- package/dist/hls/5_1700986031916/5_00001.ts +0 -0
- package/dist/hls/5_1700986031916/5_00002.ts +0 -0
- package/dist/hls/5_1700986110178/5.key +1 -0
- package/dist/hls/5_1700986110178/5.m3u8 +12 -0
- package/dist/hls/5_1700986110178/5_00000.ts +0 -0
- package/dist/hls/5_1700986110178/5_00001.ts +0 -0
- package/dist/hls/5_1700986110178/5_00002.ts +0 -0
- package/dist/hls/example.m3u8 +5 -0
- package/dist/home-c4a05e8b.js +4 -0
- package/dist/index-0e7229ea.js +328 -0
- package/dist/index-183517e7.js +265 -0
- package/dist/index-48653b79.js +162 -0
- package/dist/index-4d873a42.js +195 -0
- package/dist/index-57492b9b.js +48 -0
- package/dist/index-5975bbc0.js +126 -0
- package/dist/{index-64d03ac1.js → index-7b8840f9.js} +1 -4
- package/dist/index-7f513a14.js +175 -0
- package/dist/index-8e1e2573.js +19 -0
- package/dist/index-a1a53af6.js +354 -0
- package/dist/index-a216f328.js +662 -0
- package/dist/index-a43b144f.js +232 -0
- package/dist/index-aea75a9f.js +78 -0
- package/dist/index-b2be6bef.js +10423 -0
- package/dist/index-b90299ca.js +43 -0
- package/dist/index-d2d69b06.js +225 -0
- package/dist/index-ecaed5cc.js +439 -0
- package/dist/index-f6d6982d.js +516 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +23 -13
- package/dist/info-circle-5826decc.js +4 -0
- package/dist/info-circle-fill-90ec9aa9.js +14 -0
- package/dist/loading-09ca52df.js +4 -0
- package/dist/lock-1d2487c9.js +4 -0
- package/dist/message-b2bfdea7.js +4 -0
- package/dist/{pdf-6e38f826.js → pdf-bdb7818a.js} +1 -2
- package/dist/playwright.config.d.ts +0 -2
- package/dist/power-off-6ade5a91.js +4 -0
- package/dist/preview-b291aea8.js +4 -0
- package/dist/setting-1e5ccb6d.js +4 -0
- package/dist/style.css +1 -1
- package/dist/team-ca6a12e1.js +4 -0
- package/dist/umd/build/config.d.ts +3 -0
- package/dist/umd/components/message/index.d.ts +12 -6
- package/dist/umd/components/option/index.d.ts +2 -0
- package/dist/umd/components/{video → player}/index.d.ts +198 -87
- package/dist/umd/components/preview/excel/excel.d.ts +0 -9
- package/dist/umd/components/preview/index.d.ts +4 -0
- package/dist/umd/components/progress/index.d.ts +36 -0
- package/dist/umd/components/select/index.d.ts +101 -0
- package/dist/umd/hls/5_1700986031916/5.key +1 -0
- package/dist/umd/hls/5_1700986031916/5.m3u8 +12 -0
- package/dist/umd/hls/5_1700986031916/5_00000.ts +0 -0
- package/dist/umd/hls/5_1700986031916/5_00001.ts +0 -0
- package/dist/umd/hls/5_1700986031916/5_00002.ts +0 -0
- package/dist/umd/hls/5_1700986110178/5.key +1 -0
- package/dist/umd/hls/5_1700986110178/5.m3u8 +12 -0
- package/dist/umd/hls/5_1700986110178/5_00000.ts +0 -0
- package/dist/umd/hls/5_1700986110178/5_00001.ts +0 -0
- package/dist/umd/hls/5_1700986110178/5_00002.ts +0 -0
- package/dist/umd/hls/example.m3u8 +5 -0
- package/dist/umd/index.d.ts +4 -0
- package/dist/umd/index.umd.cjs +26 -8
- package/dist/umd/playwright.config.d.ts +0 -2
- package/dist/umd/style.css +1 -1
- package/dist/umd/utils/image.d.ts +32 -0
- package/dist/umd/utils/index.d.ts +41 -32
- package/dist/umd/utils/math.d.ts +26 -0
- package/dist/umd/utils/tween.d.ts +21 -0
- package/dist/unlock-f56086fd.js +4 -0
- package/dist/user-5c01e665.js +4 -0
- package/dist/utils/image.d.ts +32 -0
- package/dist/utils/index.d.ts +41 -32
- package/dist/utils/math.d.ts +26 -0
- package/dist/utils/tween.d.ts +21 -0
- package/dist/{index-a55c2dff.js → vendor-f71e6f68.js} +7771 -1268
- package/dist/warning-circle-035e025c.js +4 -0
- package/dist/warning-circle-fill-d17c37c9.js +4 -0
- package/package.json +38 -6
- package/readme.md +2 -3
- package/dist/_commonjs-dynamic-modules-2ceabb0b.js +0 -12
- package/dist/add-user-d07564bd.js +0 -4
- package/dist/assets/image/failImage.d.ts +0 -2
- package/dist/base-bcc748a2.js +0 -1
- package/dist/book-2a5a596c.js +0 -4
- package/dist/check-circle-2c986969.js +0 -4
- package/dist/check-circle-fill-62eaa796.js +0 -4
- package/dist/close-circle-2afb6e94.js +0 -4
- package/dist/close-circle-fill-b6906239.js +0 -4
- package/dist/close-ee3ba1d1.js +0 -4
- package/dist/docx-5262a8f1.js +0 -2635
- package/dist/eye-bd60afe1.js +0 -4
- package/dist/eye-close-bde3c1fc.js +0 -4
- package/dist/home-f824d8f4.js +0 -4
- package/dist/index-00913cab.js +0 -43
- package/dist/index-07c8e518.js +0 -327
- package/dist/index-105ed089.js +0 -127
- package/dist/index-2243317e.js +0 -155
- package/dist/index-441da303.js +0 -196
- package/dist/index-4459fbd0.js +0 -108
- package/dist/index-57d3be68.js +0 -450
- package/dist/index-a7db1b7b.js +0 -175
- package/dist/index-b580f377.js +0 -78
- package/dist/index-b99ac79f.js +0 -353
- package/dist/index-c558bde2.js +0 -218
- package/dist/info-circle-59333e1c.js +0 -4
- package/dist/info-circle-fill-3ab7660d.js +0 -4
- package/dist/jszip.min-97cf7c6a.js +0 -2655
- package/dist/loading-407d8249.js +0 -4
- package/dist/lock-6d20715b.js +0 -4
- package/dist/message-ee4fe153.js +0 -4
- package/dist/power-off-bbec6b5f.js +0 -4
- package/dist/preview-164a4944.js +0 -4
- package/dist/setting-735a1963.js +0 -4
- package/dist/team-42573142.js +0 -4
- package/dist/umd/assets/image/failImage.d.ts +0 -2
- package/dist/unlock-ae33c6f7.js +0 -4
- package/dist/user-b7098183.js +0 -4
- package/dist/warning-circle-536d4749.js +0 -4
- package/dist/warning-circle-fill-e4be98bc.js +0 -4
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { g as getPixelRatio } from "./index-d2d69b06.js";
|
|
8
|
+
import { c as createCustomError } from "./index-57492b9b.js";
|
|
9
|
+
const f7170ee498e0dd32cbdcb63fba8f75cc = ".ran-radar{position:relative;width:100%;height:100%;display:block}\n";
|
|
10
|
+
const BACKGROUND_COLOR = "rgba(0,0,0,0)";
|
|
11
|
+
const FONT_COLOR = "rgba(0,0,0,1)";
|
|
12
|
+
const POLYGON_COLOR = "#e6e6e6";
|
|
13
|
+
const LINE_COLOR = "#e6e6e6";
|
|
14
|
+
const FONT_FAMILY = "黑体";
|
|
15
|
+
const FILL_COLOR = "rgba(255,121,35,0.60)";
|
|
16
|
+
const STROKE_COLOR = "rgba(255,121,35,0.60)";
|
|
17
|
+
function Custom() {
|
|
18
|
+
if (typeof document !== "undefined" && !customElements.get("r-radar")) {
|
|
19
|
+
class RadarChart extends HTMLElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
__publicField(this, "mData");
|
|
23
|
+
__publicField(this, "mCount");
|
|
24
|
+
__publicField(this, "mW");
|
|
25
|
+
__publicField(this, "mCenter");
|
|
26
|
+
__publicField(this, "mRadius");
|
|
27
|
+
__publicField(this, "mAngle");
|
|
28
|
+
__publicField(this, "abilityRadarChartContainer");
|
|
29
|
+
__publicField(this, "abilityRadarChart");
|
|
30
|
+
__publicField(this, "_iconElement");
|
|
31
|
+
__publicField(this, "_shadowDom");
|
|
32
|
+
this.abilityRadarChartContainer = document.createElement("div");
|
|
33
|
+
this.abilityRadarChartContainer.setAttribute("class", "ran-radar");
|
|
34
|
+
this.abilityRadarChart = document.createElement("canvas");
|
|
35
|
+
this.abilityRadarChart.style.setProperty("width", "100%");
|
|
36
|
+
this.abilityRadarChart.style.setProperty("height", "100%");
|
|
37
|
+
this.abilityRadarChartContainer.appendChild(this.abilityRadarChart);
|
|
38
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
39
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
40
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
41
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
42
|
+
this._shadowDom = shadowRoot;
|
|
43
|
+
shadowRoot.appendChild(this.abilityRadarChartContainer);
|
|
44
|
+
}
|
|
45
|
+
static get observedAttributes() {
|
|
46
|
+
return [
|
|
47
|
+
"abilitys",
|
|
48
|
+
"colorPolygon",
|
|
49
|
+
"colorLine",
|
|
50
|
+
"fillColor",
|
|
51
|
+
"strokeColor"
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
get abilitys() {
|
|
55
|
+
const item = this.getAttribute("abilitys");
|
|
56
|
+
if (typeof item === "string") {
|
|
57
|
+
try {
|
|
58
|
+
const result = JSON.parse(item);
|
|
59
|
+
return result;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
return item;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return item;
|
|
65
|
+
}
|
|
66
|
+
set abilitys(value) {
|
|
67
|
+
if (typeof value === "string") {
|
|
68
|
+
this.setAttribute("abilitys", value || "");
|
|
69
|
+
} else {
|
|
70
|
+
this.setAttribute("abilitys", JSON.stringify(value) || "");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// 多边形颜色
|
|
74
|
+
get colorPolygon() {
|
|
75
|
+
return this.getAttribute("colorPolygon") || POLYGON_COLOR;
|
|
76
|
+
}
|
|
77
|
+
set colorPolygon(value) {
|
|
78
|
+
this.setAttribute("colorPolygon", value || POLYGON_COLOR);
|
|
79
|
+
}
|
|
80
|
+
// 顶点连线颜色
|
|
81
|
+
get colorLine() {
|
|
82
|
+
return this.getAttribute("colorLine") || LINE_COLOR;
|
|
83
|
+
}
|
|
84
|
+
set colorLine(value) {
|
|
85
|
+
this.setAttribute("colorLine", value || LINE_COLOR);
|
|
86
|
+
}
|
|
87
|
+
// 数据渲染处的颜色
|
|
88
|
+
get fillColor() {
|
|
89
|
+
return this.getAttribute("fillColor") || FILL_COLOR;
|
|
90
|
+
}
|
|
91
|
+
set fillColor(value) {
|
|
92
|
+
this.setAttribute("fillColor", value || FILL_COLOR);
|
|
93
|
+
}
|
|
94
|
+
// 数据渲染处线和点的颜色
|
|
95
|
+
get strokeColor() {
|
|
96
|
+
return this.getAttribute("strokeColor") || STROKE_COLOR;
|
|
97
|
+
}
|
|
98
|
+
set strokeColor(value) {
|
|
99
|
+
this.setAttribute("strokeColor", value || STROKE_COLOR);
|
|
100
|
+
}
|
|
101
|
+
refreshData() {
|
|
102
|
+
var _a;
|
|
103
|
+
const ctx = this.abilityRadarChart.getContext("2d");
|
|
104
|
+
if (!this.abilityRadarChartContainer || !ctx)
|
|
105
|
+
return;
|
|
106
|
+
const radio = getPixelRatio(ctx);
|
|
107
|
+
const width = this.abilityRadarChartContainer.clientWidth * radio;
|
|
108
|
+
const height = this.abilityRadarChartContainer.clientHeight * radio;
|
|
109
|
+
this.abilityRadarChart.width = width;
|
|
110
|
+
this.abilityRadarChart.height = height;
|
|
111
|
+
this.mW = width;
|
|
112
|
+
this.mData = this.abilitys;
|
|
113
|
+
this.mCount = ((_a = this.mData) == null ? void 0 : _a.length) || 1;
|
|
114
|
+
this.mCenter = this.mW / 2;
|
|
115
|
+
this.mRadius = this.mCenter - 50 * radio;
|
|
116
|
+
this.mAngle = Math.PI * 2 / this.mCount;
|
|
117
|
+
this.drawPolygon(ctx);
|
|
118
|
+
this.drawSide(ctx);
|
|
119
|
+
this.drawLines(ctx);
|
|
120
|
+
this.drawText(ctx);
|
|
121
|
+
this.drawRegion(ctx);
|
|
122
|
+
this.drawCircle(ctx);
|
|
123
|
+
}
|
|
124
|
+
drawSide(ctx) {
|
|
125
|
+
if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle)
|
|
126
|
+
return;
|
|
127
|
+
ctx.save();
|
|
128
|
+
ctx.strokeStyle = this.colorLine;
|
|
129
|
+
const r = this.mRadius;
|
|
130
|
+
for (let j = 0; j < this.mCount; j++) {
|
|
131
|
+
const x = this.mCenter + r * Math.sin(this.mAngle * j);
|
|
132
|
+
const y = this.mCenter + r * Math.cos(this.mAngle * j);
|
|
133
|
+
ctx.lineTo(x, y);
|
|
134
|
+
}
|
|
135
|
+
ctx.closePath();
|
|
136
|
+
ctx.stroke();
|
|
137
|
+
}
|
|
138
|
+
// 绘制多边形边
|
|
139
|
+
drawPolygon(ctx) {
|
|
140
|
+
if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle)
|
|
141
|
+
return;
|
|
142
|
+
ctx.save();
|
|
143
|
+
ctx.strokeStyle = this.colorPolygon;
|
|
144
|
+
const r = this.mRadius / 4;
|
|
145
|
+
ctx.setLineDash([6, 6]);
|
|
146
|
+
for (let i = 0; i < 4; i++) {
|
|
147
|
+
ctx.beginPath();
|
|
148
|
+
const currR = r * (i + 1);
|
|
149
|
+
for (let j = 0; j < this.mCount; j++) {
|
|
150
|
+
const x = this.mCenter + currR * Math.sin(this.mAngle * j);
|
|
151
|
+
const y = this.mCenter + currR * Math.cos(this.mAngle * j);
|
|
152
|
+
ctx.lineTo(x, y);
|
|
153
|
+
}
|
|
154
|
+
ctx.closePath();
|
|
155
|
+
ctx.stroke();
|
|
156
|
+
}
|
|
157
|
+
ctx.restore();
|
|
158
|
+
}
|
|
159
|
+
// 顶点连线
|
|
160
|
+
drawLines(ctx) {
|
|
161
|
+
if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle)
|
|
162
|
+
return;
|
|
163
|
+
ctx.save();
|
|
164
|
+
ctx.beginPath();
|
|
165
|
+
ctx.strokeStyle = this.colorLine;
|
|
166
|
+
for (let i = 0; i < this.mCount; i++) {
|
|
167
|
+
const x = this.mCenter + this.mRadius * Math.sin(this.mAngle * i);
|
|
168
|
+
const y = this.mCenter + this.mRadius * Math.cos(this.mAngle * i);
|
|
169
|
+
ctx.moveTo(this.mCenter, this.mCenter);
|
|
170
|
+
ctx.lineTo(x, y);
|
|
171
|
+
}
|
|
172
|
+
ctx.stroke();
|
|
173
|
+
ctx.restore();
|
|
174
|
+
}
|
|
175
|
+
// 绘制文本
|
|
176
|
+
drawText(ctx) {
|
|
177
|
+
var _a, _b, _c, _d;
|
|
178
|
+
if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData)
|
|
179
|
+
return;
|
|
180
|
+
ctx.save();
|
|
181
|
+
const radio = getPixelRatio(ctx);
|
|
182
|
+
const defaultFontSize = this.mCenter / 12;
|
|
183
|
+
for (let i = 0; i < this.mCount; i++) {
|
|
184
|
+
const x = this.mCenter + this.mRadius * Math.sin(this.mAngle * i);
|
|
185
|
+
const y = this.mCenter + this.mRadius * Math.cos(this.mAngle * i);
|
|
186
|
+
const backgroundColor = ((_a = this.mData[i]) == null ? void 0 : _a.backgroundColor) || BACKGROUND_COLOR;
|
|
187
|
+
const fontColor = ((_b = this.mData[i]) == null ? void 0 : _b.fontColor) || FONT_COLOR;
|
|
188
|
+
const fontFamily = ((_c = this.mData[i]) == null ? void 0 : _c.fontFamily) || FONT_FAMILY;
|
|
189
|
+
const fontSize = ((_d = this.mData[i]) == null ? void 0 : _d.fontSize) || defaultFontSize;
|
|
190
|
+
ctx.font = `${fontSize}px ${fontFamily}`;
|
|
191
|
+
if (this.mAngle * i >= 0 && this.mAngle * i < Math.PI / 2) {
|
|
192
|
+
this.drawButton(
|
|
193
|
+
ctx,
|
|
194
|
+
backgroundColor,
|
|
195
|
+
x,
|
|
196
|
+
y,
|
|
197
|
+
44 * radio,
|
|
198
|
+
24 * radio,
|
|
199
|
+
12 * radio,
|
|
200
|
+
this.mData[i].abilityName,
|
|
201
|
+
fontColor,
|
|
202
|
+
fontFamily,
|
|
203
|
+
fontSize
|
|
204
|
+
);
|
|
205
|
+
} else if (this.mAngle * i >= Math.PI / 2 && this.mAngle * i < Math.PI) {
|
|
206
|
+
this.drawButton(
|
|
207
|
+
ctx,
|
|
208
|
+
backgroundColor,
|
|
209
|
+
x,
|
|
210
|
+
y - 24 * radio,
|
|
211
|
+
44 * radio,
|
|
212
|
+
24 * radio,
|
|
213
|
+
12 * radio,
|
|
214
|
+
this.mData[i].abilityName,
|
|
215
|
+
fontColor,
|
|
216
|
+
fontFamily,
|
|
217
|
+
fontSize
|
|
218
|
+
);
|
|
219
|
+
} else if (this.mAngle * i >= Math.PI && this.mAngle * i < Math.PI * 3 / 2) {
|
|
220
|
+
this.drawButton(
|
|
221
|
+
ctx,
|
|
222
|
+
backgroundColor,
|
|
223
|
+
x - 44 * radio,
|
|
224
|
+
y - 24 * radio,
|
|
225
|
+
44 * radio,
|
|
226
|
+
24 * radio,
|
|
227
|
+
12 * radio,
|
|
228
|
+
this.mData[i].abilityName,
|
|
229
|
+
fontColor,
|
|
230
|
+
fontFamily,
|
|
231
|
+
fontSize
|
|
232
|
+
);
|
|
233
|
+
} else {
|
|
234
|
+
this.drawButton(
|
|
235
|
+
ctx,
|
|
236
|
+
backgroundColor,
|
|
237
|
+
x - 44 * radio,
|
|
238
|
+
y,
|
|
239
|
+
44 * radio,
|
|
240
|
+
24 * radio,
|
|
241
|
+
12 * radio,
|
|
242
|
+
this.mData[i].abilityName,
|
|
243
|
+
fontColor,
|
|
244
|
+
fontFamily,
|
|
245
|
+
fontSize
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
ctx.restore();
|
|
250
|
+
}
|
|
251
|
+
drawButton(ctx, color, x, y, width, height, radius, text, fontColor, fontFamily, fontSize) {
|
|
252
|
+
ctx.beginPath();
|
|
253
|
+
const radio = getPixelRatio(ctx);
|
|
254
|
+
ctx.fillStyle = color;
|
|
255
|
+
ctx.moveTo(x + radius, y);
|
|
256
|
+
ctx.lineTo(x + width - radius, y);
|
|
257
|
+
ctx.arc(
|
|
258
|
+
x + width - radius,
|
|
259
|
+
y + radius,
|
|
260
|
+
radius,
|
|
261
|
+
Math.PI * 3 / 2,
|
|
262
|
+
Math.PI * 2
|
|
263
|
+
);
|
|
264
|
+
ctx.lineTo(x + width, y + height - radius);
|
|
265
|
+
ctx.arc(
|
|
266
|
+
x + width - radius,
|
|
267
|
+
y + height - radius,
|
|
268
|
+
radius,
|
|
269
|
+
Math.PI,
|
|
270
|
+
Math.PI / 2
|
|
271
|
+
);
|
|
272
|
+
ctx.lineTo(x + radius, y + height);
|
|
273
|
+
ctx.arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
|
|
274
|
+
ctx.lineTo(x, y + radius);
|
|
275
|
+
ctx.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 3 / 2);
|
|
276
|
+
ctx.fill();
|
|
277
|
+
ctx.closePath();
|
|
278
|
+
ctx.beginPath();
|
|
279
|
+
ctx.fillStyle = fontColor;
|
|
280
|
+
ctx.font = `${fontSize || 12 * radio}px ${fontFamily}`;
|
|
281
|
+
ctx.textAlign = "center";
|
|
282
|
+
ctx.textBaseline = "middle";
|
|
283
|
+
ctx.fillText(text, x + width / 2, y + height / 2);
|
|
284
|
+
}
|
|
285
|
+
// 绘制数据区域
|
|
286
|
+
drawRegion(ctx) {
|
|
287
|
+
if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData)
|
|
288
|
+
return;
|
|
289
|
+
const radio = getPixelRatio(ctx);
|
|
290
|
+
ctx.save();
|
|
291
|
+
ctx.beginPath();
|
|
292
|
+
for (let i = 0; i < this.mCount; i++) {
|
|
293
|
+
const x = this.mCenter + this.mRadius * Math.sin(this.mAngle * i) * this.mData[i].scoreRate / 100;
|
|
294
|
+
const y = this.mCenter + this.mRadius * Math.cos(this.mAngle * i) * this.mData[i].scoreRate / 100;
|
|
295
|
+
ctx.lineTo(x, y);
|
|
296
|
+
}
|
|
297
|
+
ctx.closePath();
|
|
298
|
+
ctx.fillStyle = this.fillColor;
|
|
299
|
+
ctx.fill();
|
|
300
|
+
ctx.strokeStyle = this.strokeColor;
|
|
301
|
+
ctx.lineWidth = 1 * radio;
|
|
302
|
+
ctx.stroke();
|
|
303
|
+
ctx.restore();
|
|
304
|
+
}
|
|
305
|
+
// 画点
|
|
306
|
+
drawCircle(ctx) {
|
|
307
|
+
if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData)
|
|
308
|
+
return;
|
|
309
|
+
const radio = getPixelRatio(ctx);
|
|
310
|
+
ctx.save();
|
|
311
|
+
for (let i = 0; i < this.mCount; i++) {
|
|
312
|
+
const x = this.mCenter + this.mRadius * Math.sin(this.mAngle * i) * this.mData[i].scoreRate / 100;
|
|
313
|
+
const y = this.mCenter + this.mRadius * Math.cos(this.mAngle * i) * this.mData[i].scoreRate / 100;
|
|
314
|
+
ctx.beginPath();
|
|
315
|
+
ctx.arc(x, y, 3, 0, Math.PI * 2);
|
|
316
|
+
ctx.lineWidth = 1.5 * radio;
|
|
317
|
+
ctx.strokeStyle = this.strokeColor;
|
|
318
|
+
ctx.stroke();
|
|
319
|
+
}
|
|
320
|
+
ctx.restore();
|
|
321
|
+
}
|
|
322
|
+
connectedCallback() {
|
|
323
|
+
this.refreshData();
|
|
324
|
+
}
|
|
325
|
+
disconnectCallback() {
|
|
326
|
+
}
|
|
327
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
328
|
+
const attribute = [
|
|
329
|
+
"abilitys",
|
|
330
|
+
"colorPolygon",
|
|
331
|
+
"colorLine",
|
|
332
|
+
"fillColor",
|
|
333
|
+
"strokeColor"
|
|
334
|
+
];
|
|
335
|
+
if (attribute.includes(name) && this.abilityRadarChartContainer && oldValue !== newValue) {
|
|
336
|
+
this.refreshData();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
customElements.define("r-radar", RadarChart);
|
|
341
|
+
return RadarChart;
|
|
342
|
+
} else {
|
|
343
|
+
return createCustomError("document is undefined or r-radar is exist");
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const index = Custom();
|
|
347
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
348
|
+
__proto__: null,
|
|
349
|
+
default: index
|
|
350
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
351
|
+
export {
|
|
352
|
+
index as a,
|
|
353
|
+
index$1 as i
|
|
354
|
+
};
|