ranui 0.1.5 → 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.
Files changed (171) hide show
  1. package/dist/add-user-b2bed3e7.js +4 -0
  2. package/dist/book-b11a68eb.js +4 -0
  3. package/dist/build/config.d.ts +3 -0
  4. package/dist/check-circle-74bd09c3.js +4 -0
  5. package/dist/check-circle-fill-dc284144.js +4 -0
  6. package/dist/close-20925345.js +4 -0
  7. package/dist/close-circle-720c18be.js +4 -0
  8. package/dist/close-circle-fill-238a66b1.js +4 -0
  9. package/dist/components/button/index.d.ts +1 -331
  10. package/dist/components/button/index.js +4 -2
  11. package/dist/components/icon/index.js +3 -1
  12. package/dist/components/image/index.js +1 -1
  13. package/dist/components/input/index.d.ts +1 -435
  14. package/dist/components/input/index.js +2 -2
  15. package/dist/components/message/index.d.ts +12 -6
  16. package/dist/components/message/index.js +1 -2
  17. package/dist/components/modal/index.js +4 -0
  18. package/dist/components/option/index.d.ts +2 -0
  19. package/dist/components/option/index.js +95 -0
  20. package/dist/components/{video → player}/index.d.ts +245 -114
  21. package/dist/components/player/index.js +11 -0
  22. package/dist/components/preview/colz.d.ts +1 -1
  23. package/dist/components/preview/excel/excel.d.ts +0 -9
  24. package/dist/components/preview/index.d.ts +4 -0
  25. package/dist/components/preview/index.js +5 -4
  26. package/dist/components/preview/pptx/process_pptx.d.ts +1 -1
  27. package/dist/components/progress/index.d.ts +36 -0
  28. package/dist/components/progress/index.js +8 -0
  29. package/dist/components/radar/index.d.ts +2 -0
  30. package/dist/components/radar/index.js +7 -0
  31. package/dist/components/select/index.d.ts +101 -0
  32. package/dist/components/select/index.js +11 -0
  33. package/dist/components/skeleton/index.js +1 -1
  34. package/dist/components/tab/index.d.ts +47 -27
  35. package/dist/components/tab/index.js +4 -2
  36. package/dist/components/tabpane/index.d.ts +47 -27
  37. package/dist/components/tabpane/index.js +1 -1
  38. package/dist/docx-c5d02d8c.js +21 -0
  39. package/dist/eye-5e742329.js +4 -0
  40. package/dist/eye-close-3874f1ae.js +4 -0
  41. package/dist/hls/5_1700986031916/5.key +1 -0
  42. package/dist/hls/5_1700986031916/5.m3u8 +12 -0
  43. package/dist/hls/5_1700986031916/5_00000.ts +0 -0
  44. package/dist/hls/5_1700986031916/5_00001.ts +0 -0
  45. package/dist/hls/5_1700986031916/5_00002.ts +0 -0
  46. package/dist/hls/5_1700986110178/5.key +1 -0
  47. package/dist/hls/5_1700986110178/5.m3u8 +12 -0
  48. package/dist/hls/5_1700986110178/5_00000.ts +0 -0
  49. package/dist/hls/5_1700986110178/5_00001.ts +0 -0
  50. package/dist/hls/5_1700986110178/5_00002.ts +0 -0
  51. package/dist/hls/example.m3u8 +5 -0
  52. package/dist/home-c4a05e8b.js +4 -0
  53. package/dist/index-0e7229ea.js +328 -0
  54. package/dist/index-183517e7.js +265 -0
  55. package/dist/index-48653b79.js +162 -0
  56. package/dist/index-4d873a42.js +195 -0
  57. package/dist/index-57492b9b.js +48 -0
  58. package/dist/index-5975bbc0.js +126 -0
  59. package/dist/index-7b8840f9.js +18690 -0
  60. package/dist/index-7f513a14.js +175 -0
  61. package/dist/index-8e1e2573.js +19 -0
  62. package/dist/index-a1a53af6.js +354 -0
  63. package/dist/index-a216f328.js +662 -0
  64. package/dist/index-a43b144f.js +232 -0
  65. package/dist/index-aea75a9f.js +78 -0
  66. package/dist/index-b2be6bef.js +10423 -0
  67. package/dist/index-b90299ca.js +43 -0
  68. package/dist/index-d2d69b06.js +225 -0
  69. package/dist/index-ecaed5cc.js +439 -0
  70. package/dist/index-f6d6982d.js +516 -0
  71. package/dist/index.d.ts +5 -0
  72. package/dist/index.js +24 -12
  73. package/dist/info-circle-5826decc.js +4 -0
  74. package/dist/info-circle-fill-90ec9aa9.js +14 -0
  75. package/dist/loading-09ca52df.js +4 -0
  76. package/dist/lock-1d2487c9.js +4 -0
  77. package/dist/message-b2bfdea7.js +4 -0
  78. package/dist/{pdf-bd9a47ff.js → pdf-bdb7818a.js} +1 -2
  79. package/dist/playwright.config.d.ts +0 -2
  80. package/dist/plugins/auto-import-file.d.ts +0 -10
  81. package/dist/power-off-6ade5a91.js +4 -0
  82. package/dist/preview-b291aea8.js +4 -0
  83. package/dist/setting-1e5ccb6d.js +4 -0
  84. package/dist/style.css +1 -1
  85. package/dist/team-ca6a12e1.js +4 -0
  86. package/dist/umd/build/config.d.ts +3 -0
  87. package/dist/umd/components/button/index.d.ts +1 -331
  88. package/dist/umd/components/input/index.d.ts +1 -435
  89. package/dist/umd/components/message/index.d.ts +12 -6
  90. package/dist/umd/components/option/index.d.ts +2 -0
  91. package/dist/umd/components/{video → player}/index.d.ts +245 -114
  92. package/dist/umd/components/preview/colz.d.ts +1 -1
  93. package/dist/umd/components/preview/excel/excel.d.ts +0 -9
  94. package/dist/umd/components/preview/index.d.ts +4 -0
  95. package/dist/umd/components/preview/pptx/process_pptx.d.ts +1 -1
  96. package/dist/umd/components/progress/index.d.ts +36 -0
  97. package/dist/umd/components/radar/index.d.ts +2 -0
  98. package/dist/umd/components/select/index.d.ts +101 -0
  99. package/dist/umd/components/tab/index.d.ts +47 -27
  100. package/dist/umd/components/tabpane/index.d.ts +47 -27
  101. package/dist/umd/hls/5_1700986031916/5.key +1 -0
  102. package/dist/umd/hls/5_1700986031916/5.m3u8 +12 -0
  103. package/dist/umd/hls/5_1700986031916/5_00000.ts +0 -0
  104. package/dist/umd/hls/5_1700986031916/5_00001.ts +0 -0
  105. package/dist/umd/hls/5_1700986031916/5_00002.ts +0 -0
  106. package/dist/umd/hls/5_1700986110178/5.key +1 -0
  107. package/dist/umd/hls/5_1700986110178/5.m3u8 +12 -0
  108. package/dist/umd/hls/5_1700986110178/5_00000.ts +0 -0
  109. package/dist/umd/hls/5_1700986110178/5_00001.ts +0 -0
  110. package/dist/umd/hls/5_1700986110178/5_00002.ts +0 -0
  111. package/dist/umd/hls/example.m3u8 +5 -0
  112. package/dist/umd/index.d.ts +5 -0
  113. package/dist/umd/index.umd.cjs +26 -8
  114. package/dist/umd/playwright.config.d.ts +0 -2
  115. package/dist/umd/plugins/auto-import-file.d.ts +0 -10
  116. package/dist/umd/style.css +1 -1
  117. package/dist/umd/utils/image.d.ts +32 -0
  118. package/dist/umd/utils/index.d.ts +44 -17
  119. package/dist/umd/utils/math.d.ts +26 -0
  120. package/dist/umd/utils/tween.d.ts +21 -0
  121. package/dist/unlock-f56086fd.js +4 -0
  122. package/dist/user-5c01e665.js +4 -0
  123. package/dist/utils/image.d.ts +32 -0
  124. package/dist/utils/index.d.ts +44 -17
  125. package/dist/utils/math.d.ts +26 -0
  126. package/dist/utils/tween.d.ts +21 -0
  127. package/dist/{index-714a1eb8.js → vendor-f71e6f68.js} +7771 -1267
  128. package/dist/warning-circle-035e025c.js +4 -0
  129. package/dist/warning-circle-fill-d17c37c9.js +4 -0
  130. package/package.json +54 -7
  131. package/readme.md +78 -50
  132. package/dist/_commonjs-dynamic-modules-2ceabb0b.js +0 -12
  133. package/dist/add-user-d07564bd.js +0 -4
  134. package/dist/assets/image/failImage.d.ts +0 -2
  135. package/dist/base-bcc748a2.js +0 -1
  136. package/dist/book-2a5a596c.js +0 -4
  137. package/dist/check-circle-2c986969.js +0 -4
  138. package/dist/check-circle-fill-62eaa796.js +0 -4
  139. package/dist/close-circle-2afb6e94.js +0 -4
  140. package/dist/close-circle-fill-b6906239.js +0 -4
  141. package/dist/close-ee3ba1d1.js +0 -4
  142. package/dist/docx-5262a8f1.js +0 -2635
  143. package/dist/eye-bd60afe1.js +0 -4
  144. package/dist/eye-close-bde3c1fc.js +0 -4
  145. package/dist/home-f824d8f4.js +0 -4
  146. package/dist/index-00913cab.js +0 -43
  147. package/dist/index-03e90266.js +0 -455
  148. package/dist/index-105ed089.js +0 -127
  149. package/dist/index-1ffff466.js +0 -23077
  150. package/dist/index-2243317e.js +0 -155
  151. package/dist/index-441da303.js +0 -196
  152. package/dist/index-9861f093.js +0 -215
  153. package/dist/index-ac3f8c4f.js +0 -324
  154. package/dist/index-b580f377.js +0 -78
  155. package/dist/index-c61cbf56.js +0 -74
  156. package/dist/index-db03e134.js +0 -177
  157. package/dist/info-circle-59333e1c.js +0 -4
  158. package/dist/info-circle-fill-3ab7660d.js +0 -4
  159. package/dist/jszip.min-97cf7c6a.js +0 -2655
  160. package/dist/loading-407d8249.js +0 -4
  161. package/dist/lock-6d20715b.js +0 -4
  162. package/dist/message-ee4fe153.js +0 -4
  163. package/dist/power-off-bbec6b5f.js +0 -4
  164. package/dist/preview-164a4944.js +0 -4
  165. package/dist/setting-735a1963.js +0 -4
  166. package/dist/team-42573142.js +0 -4
  167. package/dist/umd/assets/image/failImage.d.ts +0 -2
  168. package/dist/unlock-ae33c6f7.js +0 -4
  169. package/dist/user-b7098183.js +0 -4
  170. package/dist/warning-circle-536d4749.js +0 -4
  171. package/dist/warning-circle-fill-e4be98bc.js +0 -4
@@ -0,0 +1,175 @@
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 { s as str2Xml } from "./index-d2d69b06.js";
8
+ const __variableDynamicImportRuntimeHelper = (glob, path) => {
9
+ const v = glob[path];
10
+ if (v) {
11
+ return typeof v === "function" ? v() : Promise.resolve(v);
12
+ }
13
+ return new Promise((_, reject) => {
14
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
15
+ });
16
+ };
17
+ const f7170ee498e0dd32cbdcb63fba8f75cc = ":host{display:inline-flex}:host .ran-icon{display:flex}:host([spin]){animation-name:rotate;animation-duration:1.4s;animation-timing-function:linear;animation-iteration-count:infinite}@keyframes rotate{to{transform:rotate(360deg)}}\n";
18
+ const X_LINKS_NS = "http://www.w3.org/1999/xlink";
19
+ const X_LINK_HREF = "xlink:href";
20
+ function Custom() {
21
+ if (typeof window !== "undefined" && !customElements.get("r-icon")) {
22
+ class CustomElement extends HTMLElement {
23
+ constructor() {
24
+ super();
25
+ __publicField(this, "_icon");
26
+ __publicField(this, "_div");
27
+ /**
28
+ * @description: 本地加载icon
29
+ */
30
+ __publicField(this, "loadLocal", () => {
31
+ return new Promise((resolve, reject) => {
32
+ __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../assets/icons/add-user.svg": () => import("./add-user-b2bed3e7.js"), "../../assets/icons/arrow-down.svg": () => import("./info-circle-fill-90ec9aa9.js").then((n) => n.a), "../../assets/icons/book.svg": () => import("./book-b11a68eb.js"), "../../assets/icons/check-circle-fill.svg": () => import("./check-circle-fill-dc284144.js"), "../../assets/icons/check-circle.svg": () => import("./check-circle-74bd09c3.js"), "../../assets/icons/close-circle-fill.svg": () => import("./close-circle-fill-238a66b1.js"), "../../assets/icons/close-circle.svg": () => import("./close-circle-720c18be.js"), "../../assets/icons/close.svg": () => import("./close-20925345.js"), "../../assets/icons/eye-close.svg": () => import("./eye-close-3874f1ae.js"), "../../assets/icons/eye.svg": () => import("./eye-5e742329.js"), "../../assets/icons/home.svg": () => import("./home-c4a05e8b.js"), "../../assets/icons/info-circle-fill.svg": () => import("./info-circle-fill-90ec9aa9.js").then((n) => n.i), "../../assets/icons/info-circle.svg": () => import("./info-circle-5826decc.js"), "../../assets/icons/loading.svg": () => import("./loading-09ca52df.js"), "../../assets/icons/lock.svg": () => import("./lock-1d2487c9.js"), "../../assets/icons/message.svg": () => import("./message-b2bfdea7.js"), "../../assets/icons/power-off.svg": () => import("./power-off-6ade5a91.js"), "../../assets/icons/preview.svg": () => import("./preview-b291aea8.js"), "../../assets/icons/setting.svg": () => import("./setting-1e5ccb6d.js"), "../../assets/icons/team.svg": () => import("./team-ca6a12e1.js"), "../../assets/icons/unlock.svg": () => import("./unlock-f56086fd.js"), "../../assets/icons/user.svg": () => import("./user-5c01e665.js"), "../../assets/icons/warning-circle-fill.svg": () => import("./warning-circle-fill-d17c37c9.js"), "../../assets/icons/warning-circle.svg": () => import("./warning-circle-035e025c.js") }), `../../assets/icons/${this.name}.svg`).then((result) => {
33
+ if (result && result.default && result.default._identification) {
34
+ const { data } = result.default;
35
+ this._icon && this._div.removeChild(this._icon);
36
+ this._icon = str2Xml(data, "image/svg+xml");
37
+ if (this._icon) {
38
+ this._div.appendChild(this._icon);
39
+ this.setSize();
40
+ this.setColor();
41
+ resolve();
42
+ }
43
+ } else {
44
+ this.loadNs();
45
+ reject(
46
+ `
47
+ couldn't be loaded by r-icon, message: ${this.name} icon is undefined`
48
+ );
49
+ }
50
+ }).catch((error) => {
51
+ this.loadNs();
52
+ });
53
+ });
54
+ });
55
+ /**
56
+ * @description: NS加载icon
57
+ */
58
+ __publicField(this, "loadNs", () => {
59
+ if (this._icon && this._div) {
60
+ this._div.removeChild(this._icon);
61
+ }
62
+ this._icon = document.createElement("svg");
63
+ this._icon.setAttribute("class", "icon");
64
+ this._icon.setAttribute("viewBox", "0 0 1024 1024");
65
+ this._icon.setAttribute("width", "100");
66
+ this._icon.setAttribute("height", "100");
67
+ const use = document.createElementNS(X_LINKS_NS, "use");
68
+ use.setAttributeNS(
69
+ X_LINKS_NS,
70
+ X_LINK_HREF,
71
+ `../../assets/iconfont/icon.svg#icon-${this.name}`
72
+ );
73
+ this._icon.appendChild(use);
74
+ this._div.appendChild(this._icon);
75
+ });
76
+ /**
77
+ * @description: 根据name属性加载对应的svg
78
+ */
79
+ __publicField(this, "setIcon", async () => {
80
+ if (this.name) {
81
+ this.loadLocal();
82
+ }
83
+ });
84
+ /**
85
+ * @description: 设置icon的大小
86
+ */
87
+ __publicField(this, "setSize", () => {
88
+ if (this._icon && this.size) {
89
+ this._icon.setAttribute("width", this.size);
90
+ this._icon.setAttribute("height", this.size);
91
+ }
92
+ });
93
+ /**
94
+ * @description: 设置icon的颜色
95
+ */
96
+ __publicField(this, "setColor", () => {
97
+ if (this._icon) {
98
+ this.color ? this._icon.setAttribute("fill", this.color) : this._icon.setAttribute("fill", "currentColor");
99
+ }
100
+ });
101
+ /**
102
+ * @description: 设置是否旋转和旋转的速度
103
+ */
104
+ __publicField(this, "setSpin", () => {
105
+ if (this.spin) {
106
+ this.style.setProperty("animation-duration", `${this.spin}s`);
107
+ }
108
+ });
109
+ this._div = document.createElement("div");
110
+ this._div.setAttribute("class", "ran-icon");
111
+ const shadowRoot = this.attachShadow({ mode: "closed" });
112
+ const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
113
+ F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
114
+ shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
115
+ shadowRoot.appendChild(this._div);
116
+ }
117
+ static get observedAttributes() {
118
+ return ["name", "size", "color", "spin"];
119
+ }
120
+ get name() {
121
+ return this.getAttribute("name");
122
+ }
123
+ set name(value) {
124
+ if (value)
125
+ this.setAttribute("name", value);
126
+ }
127
+ get size() {
128
+ return this.getAttribute("size");
129
+ }
130
+ set size(value) {
131
+ if (value)
132
+ this.setAttribute("size", value);
133
+ }
134
+ get color() {
135
+ return this.getAttribute("color");
136
+ }
137
+ set color(value) {
138
+ if (value)
139
+ this.setAttribute("color", value);
140
+ }
141
+ get spin() {
142
+ return this.getAttribute("spin");
143
+ }
144
+ set spin(value) {
145
+ if (value != null)
146
+ this.setAttribute("spin", value);
147
+ }
148
+ connectedCallback() {
149
+ this.setIcon();
150
+ }
151
+ attributeChangedCallback(name, oldValue, newValue) {
152
+ if (newValue !== oldValue) {
153
+ if (name === "name")
154
+ this.setIcon();
155
+ if (name === "size")
156
+ this.setSize();
157
+ if (name === "color")
158
+ this.setColor();
159
+ if (name === "spin")
160
+ this.setSpin();
161
+ }
162
+ }
163
+ }
164
+ customElements.define("r-icon", CustomElement);
165
+ }
166
+ }
167
+ const index = Custom();
168
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
169
+ __proto__: null,
170
+ default: index
171
+ }, Symbol.toStringTag, { value: "Module" }));
172
+ export {
173
+ index as a,
174
+ index$1 as i
175
+ };
@@ -0,0 +1,19 @@
1
+ function Custom() {
2
+ if (typeof window !== "undefined" && !customElements.get("r-modal")) {
3
+ class CustomModal extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ }
7
+ }
8
+ customElements.define("r-modal", CustomModal);
9
+ }
10
+ }
11
+ const index = Custom();
12
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13
+ __proto__: null,
14
+ default: index
15
+ }, Symbol.toStringTag, { value: "Module" }));
16
+ export {
17
+ index as a,
18
+ index$1 as i
19
+ };
@@ -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
+ };