ranui 0.1.8 → 0.1.10-alpha.1

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 (176) hide show
  1. package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +12 -0
  2. package/dist/arrow-down-C9jBUUt3.js +30 -0
  3. package/dist/assets/image/failImage.d.ts +2 -0
  4. package/dist/button.js +7 -0
  5. package/dist/checkbox.js +7 -0
  6. package/dist/colorpicker.js +13 -0
  7. package/dist/{colz-746223ab.js → colz-CRDozfZA.js} +1 -5
  8. package/dist/components/button/index.d.ts +38 -1
  9. package/dist/components/checkbox/index.d.ts +27 -0
  10. package/dist/components/colorpicker/index.d.ts +122 -0
  11. package/dist/components/content/index.d.ts +15 -0
  12. package/dist/components/input/index.d.ts +208 -1
  13. package/dist/components/message/index.d.ts +2 -0
  14. package/dist/components/option/index.d.ts +2 -1
  15. package/dist/components/player/index.d.ts +207 -493
  16. package/dist/components/popover/index.d.ts +39 -0
  17. package/dist/components/preview/docx.d.ts +1 -1
  18. package/dist/components/preview/index.d.ts +2 -0
  19. package/dist/components/preview/pptx/process_pptx.d.ts +1 -1
  20. package/dist/components/progress/index.d.ts +11 -5
  21. package/dist/components/radar/index.d.ts +1 -1
  22. package/dist/components/scratch/index.d.ts +23 -0
  23. package/dist/components/select/index.d.ts +18 -6
  24. package/dist/components/tab/index.d.ts +5 -0
  25. package/dist/components/tabpane/index.d.ts +5 -0
  26. package/dist/content.js +6 -0
  27. package/dist/docx-ajDUtnbM.js +3665 -0
  28. package/dist/global-DOfcrQ2N.js +4 -0
  29. package/dist/icon.js +6 -0
  30. package/dist/iconShadowless.js +6 -0
  31. package/dist/image.js +4 -0
  32. package/dist/index-0fvHQjmN.js +298 -0
  33. package/dist/{index-f6d6982d.js → index-BLepXisd.js} +101 -84
  34. package/dist/{index-b2be6bef.js → index-BOoNI-Al.js} +904 -1078
  35. package/dist/index-BPBRPxND.js +195 -0
  36. package/dist/{index-b90299ca.js → index-BpOERe9M.js} +1 -1
  37. package/dist/index-Bv6Z6rIe.js +498 -0
  38. package/dist/index-ByJ7zZdQ.js +65641 -0
  39. package/dist/{index-5975bbc0.js → index-C1x9Popy.js} +1 -1
  40. package/dist/index-CCNK5H8T.js +103 -0
  41. package/dist/{index-a1a53af6.js → index-CD09p_mF.js} +7 -31
  42. package/dist/index-CFnsLnrb.js +496 -0
  43. package/dist/{index-a43b144f.js → index-CJZp9lE4.js} +29 -50
  44. package/dist/{index-57492b9b.js → index-CSnBqUsQ.js} +48 -1
  45. package/dist/index-CWWI8SHO.js +206 -0
  46. package/dist/{index-7b8840f9.js → index-CZlEoE62.js} +220 -1010
  47. package/dist/index-CbyMC6Yz.js +59 -0
  48. package/dist/index-CiBVH-oH.js +258 -0
  49. package/dist/{index-0e7229ea.js → index-DUMmFdJ7.js} +9 -21
  50. package/dist/{index-aea75a9f.js → index-Du-Biu-I.js} +1 -1
  51. package/dist/index-EnzWG8R0.js +521 -0
  52. package/dist/index-F2RO3OU4.js +501 -0
  53. package/dist/{index-7f513a14.js → index-GavQwMDL.js} +11 -29
  54. package/dist/{index-48653b79.js → index-suip9eAw.js} +2 -2
  55. package/dist/index.d.ts +18 -14
  56. package/dist/index.js +23 -19
  57. package/dist/info-circle-fill-CFeVMdci.js +4 -0
  58. package/dist/input.js +6 -0
  59. package/dist/inputShadowless.js +6 -0
  60. package/dist/jszip.min-Ca6PjkYs.js +2674 -0
  61. package/dist/message.js +5 -0
  62. package/dist/modal.js +4 -0
  63. package/dist/{components/option/index.js → option.js} +3 -6
  64. package/dist/{pdf-bdb7818a.js → pdf-B2a6ll8f.js} +1 -1
  65. package/dist/player.js +8 -0
  66. package/dist/popover.js +6 -0
  67. package/dist/preview.js +7 -0
  68. package/dist/progress.js +7 -0
  69. package/dist/radar.js +6 -0
  70. package/dist/select.js +10 -0
  71. package/dist/selectShadowless.js +10 -0
  72. package/dist/{umd/components/image → shadowless/icon}/index.d.ts +1 -0
  73. package/dist/shadowless/input/index.d.ts +210 -0
  74. package/dist/{umd/components → shadowless}/select/index.d.ts +19 -11
  75. package/dist/shadowless/shadowless/index.js +14 -0
  76. package/dist/shadowless.d.ts +3 -0
  77. package/dist/skeleton.js +4 -0
  78. package/dist/sprite-CH2zLtZy.js +141 -0
  79. package/dist/style.css +1 -1
  80. package/dist/tab.js +6 -0
  81. package/dist/tabpane.js +4 -0
  82. package/dist/tsconfig.json +29 -0
  83. package/dist/umd/index.umd.cjs +21 -32
  84. package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
  85. package/dist/umd/shadowless/style.css +1 -0
  86. package/dist/umd/style.css +1 -1
  87. package/dist/utils/color.d.ts +52 -0
  88. package/dist/utils/index.d.ts +9 -1
  89. package/dist/utils-BMBEcoPj.js +356 -0
  90. package/dist/vite.config.d.ts +1 -0
  91. package/package.json +61 -39
  92. package/readme.md +14 -14
  93. package/typings.d.ts +101 -0
  94. package/dist/components/button/index.js +0 -7
  95. package/dist/components/icon/index.js +0 -6
  96. package/dist/components/image/index.js +0 -4
  97. package/dist/components/input/index.js +0 -5
  98. package/dist/components/message/index.js +0 -4
  99. package/dist/components/modal/index.js +0 -4
  100. package/dist/components/player/index.js +0 -11
  101. package/dist/components/preview/index.js +0 -8
  102. package/dist/components/progress/index.js +0 -8
  103. package/dist/components/radar/index.js +0 -7
  104. package/dist/components/select/index.js +0 -11
  105. package/dist/components/skeleton/index.js +0 -4
  106. package/dist/components/tab/index.js +0 -7
  107. package/dist/components/tabpane/index.js +0 -4
  108. package/dist/docx-c5d02d8c.js +0 -21
  109. package/dist/index-183517e7.js +0 -265
  110. package/dist/index-4d873a42.js +0 -195
  111. package/dist/index-a216f328.js +0 -662
  112. package/dist/index-d2d69b06.js +0 -225
  113. package/dist/index-ecaed5cc.js +0 -439
  114. package/dist/info-circle-fill-90ec9aa9.js +0 -14
  115. package/dist/umd/build/config.d.ts +0 -3
  116. package/dist/umd/build/config.umd.d.ts +0 -2
  117. package/dist/umd/components/button/index.d.ts +0 -2
  118. package/dist/umd/components/form/index.d.ts +0 -2
  119. package/dist/umd/components/icon/index.d.ts +0 -2
  120. package/dist/umd/components/input/index.d.ts +0 -2
  121. package/dist/umd/components/message/index.d.ts +0 -14
  122. package/dist/umd/components/modal/index.d.ts +0 -2
  123. package/dist/umd/components/option/index.d.ts +0 -2
  124. package/dist/umd/components/player/index.d.ts +0 -524
  125. package/dist/umd/components/preview/colz.d.ts +0 -72
  126. package/dist/umd/components/preview/docx.d.ts +0 -8
  127. package/dist/umd/components/preview/excel/excel.d.ts +0 -2
  128. package/dist/umd/components/preview/excel/index.d.ts +0 -1
  129. package/dist/umd/components/preview/excel/media.d.ts +0 -37
  130. package/dist/umd/components/preview/index.d.ts +0 -6
  131. package/dist/umd/components/preview/pdf.d.ts +0 -1
  132. package/dist/umd/components/preview/pptx/index.d.ts +0 -16
  133. package/dist/umd/components/preview/pptx/process_pptx.d.ts +0 -23
  134. package/dist/umd/components/preview/pptx/t_xml.d.ts +0 -1
  135. package/dist/umd/components/preview/pptx/worker.d.ts +0 -1
  136. package/dist/umd/components/progress/index.d.ts +0 -36
  137. package/dist/umd/components/radar/index.d.ts +0 -2
  138. package/dist/umd/components/skeleton/index.d.ts +0 -2
  139. package/dist/umd/components/tab/index.d.ts +0 -403
  140. package/dist/umd/components/tabpane/index.d.ts +0 -347
  141. package/dist/umd/index.d.ts +0 -14
  142. package/dist/umd/playwright.config.d.ts +0 -9
  143. package/dist/umd/plugins/auto-import-file.d.ts +0 -0
  144. package/dist/umd/plugins/load-style.d.ts +0 -6
  145. package/dist/umd/plugins/load-svg.d.ts +0 -9
  146. package/dist/umd/tests/button.spec.d.ts +0 -1
  147. package/dist/umd/utils/image.d.ts +0 -32
  148. package/dist/umd/utils/index.d.ts +0 -64
  149. package/dist/umd/utils/math.d.ts +0 -26
  150. package/dist/umd/utils/tween.d.ts +0 -21
  151. package/dist/umd/vite.config.d.ts +0 -6
  152. package/dist/vendor-f71e6f68.js +0 -92126
  153. /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
  154. /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
  155. /package/dist/{umd/build/config.es.d.ts → build/config.sha.d.ts} +0 -0
  156. /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
  157. /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
  158. /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
  159. /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
  160. /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
  161. /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
  162. /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
  163. /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
  164. /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
  165. /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
  166. /package/dist/{loading-09ca52df.js → loading-Dcc5RApI.js} +0 -0
  167. /package/dist/{lock-1d2487c9.js → lock-Cr7BnmWN.js} +0 -0
  168. /package/dist/{message-b2bfdea7.js → message-D36_Zo2l.js} +0 -0
  169. /package/dist/{power-off-6ade5a91.js → power-off-lQRbiBak.js} +0 -0
  170. /package/dist/{preview-b291aea8.js → preview-CJbz9GjO.js} +0 -0
  171. /package/dist/{setting-1e5ccb6d.js → setting-DemlgzVC.js} +0 -0
  172. /package/dist/{team-ca6a12e1.js → team-tl4NJXPC.js} +0 -0
  173. /package/dist/{unlock-f56086fd.js → unlock-CeU74z9n.js} +0 -0
  174. /package/dist/{user-5c01e665.js → user-B-eVXwuk.js} +0 -0
  175. /package/dist/{warning-circle-035e025c.js → warning-circle-DDUgEDIv.js} +0 -0
  176. /package/dist/{warning-circle-fill-d17c37c9.js → warning-circle-fill-lODUKz0i.js} +0 -0
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- const f7170ee498e0dd32cbdcb63fba8f75cc = "";
7
+ const f7170ee498e0dd32cbdcb63fba8f75cc = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}";
8
8
  function CustomElement() {
9
9
  if (typeof window !== "undefined" && !customElements.get("r-tab")) {
10
10
  class TabPane extends HTMLElement {
@@ -0,0 +1,103 @@
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 { a as addClassToElement, r as removeClassToElement } from "./utils-BMBEcoPj.js";
8
+ import { H as HTMLElementSSR, f as falseList, c as createCustomError } from "./index-CSnBqUsQ.js";
9
+ class Checkbox extends HTMLElementSSR() {
10
+ constructor() {
11
+ super();
12
+ __publicField(this, "checkInput");
13
+ __publicField(this, "checkInner");
14
+ __publicField(this, "context");
15
+ __publicField(this, "updateChecked", () => {
16
+ const { checked } = this.context;
17
+ if (checked) {
18
+ addClassToElement(this, "ran-checkbox-checked");
19
+ } else {
20
+ removeClassToElement(this, "ran-checkbox-checked");
21
+ }
22
+ });
23
+ __publicField(this, "update", () => {
24
+ this.updateChecked();
25
+ });
26
+ __publicField(this, "onChange", () => {
27
+ const { checked } = this.context;
28
+ this.context.checked = !checked;
29
+ this.dispatchEvent(
30
+ new CustomEvent("change", {
31
+ detail: {
32
+ checked: this.context.checked
33
+ }
34
+ })
35
+ );
36
+ this.update();
37
+ });
38
+ this.checkInput = document.createElement("input");
39
+ this.checkInput.setAttribute("class", "ran-checkbox-input");
40
+ this.checkInput.setAttribute("type", "checkbox");
41
+ this.checkInner = document.createElement("span");
42
+ this.checkInner.setAttribute("class", "ran-checkbox-inner");
43
+ this.context = {
44
+ checked: false
45
+ };
46
+ }
47
+ static get observedAttributes() {
48
+ return ["disabled", "checked"];
49
+ }
50
+ get disabled() {
51
+ return this.getAttribute("disabled") || "";
52
+ }
53
+ set disabled(value) {
54
+ this.setAttribute("disabled", value);
55
+ }
56
+ get checked() {
57
+ const checked = this.getAttribute("checked");
58
+ if (falseList.includes(checked)) {
59
+ this.context.checked = false;
60
+ }
61
+ return `${this.context.checked}`;
62
+ }
63
+ set checked(value) {
64
+ if (falseList.includes(value)) {
65
+ this.setAttribute("checked", "false");
66
+ this.context.checked = false;
67
+ } else {
68
+ this.setAttribute("checked", "true");
69
+ this.context.checked = true;
70
+ }
71
+ this.updateChecked();
72
+ }
73
+ connectedCallback() {
74
+ this.setAttribute("class", "ran-checkbox");
75
+ this.appendChild(this.checkInput);
76
+ this.appendChild(this.checkInner);
77
+ this.addEventListener("click", this.onChange);
78
+ }
79
+ disconnectCallback() {
80
+ this.removeEventListener("click", this.onChange);
81
+ }
82
+ attributeChangedCallback(name, oldValue, newValue) {
83
+ }
84
+ }
85
+ function Custom() {
86
+ if (typeof document !== "undefined" && !customElements.get("r-checkbox")) {
87
+ customElements.define("r-checkbox", Checkbox);
88
+ return Checkbox;
89
+ } else {
90
+ return createCustomError("document is undefined or r-checkbox is exist");
91
+ }
92
+ }
93
+ const index = Custom();
94
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
95
+ __proto__: null,
96
+ Checkbox,
97
+ default: index
98
+ }, Symbol.toStringTag, { value: "Module" }));
99
+ export {
100
+ Checkbox as C,
101
+ index as a,
102
+ index$1 as i
103
+ };
@@ -4,9 +4,9 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
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";
7
+ import { g as getPixelRatio } from "./utils-BMBEcoPj.js";
8
+ import { c as createCustomError } from "./index-CSnBqUsQ.js";
9
+ const f7170ee498e0dd32cbdcb63fba8f75cc = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.ran-radar{position:relative;width:100%;height:100%;display:block}";
10
10
  const BACKGROUND_COLOR = "rgba(0,0,0,0)";
11
11
  const FONT_COLOR = "rgba(0,0,0,1)";
12
12
  const POLYGON_COLOR = "#e6e6e6";
@@ -43,13 +43,7 @@ function Custom() {
43
43
  shadowRoot.appendChild(this.abilityRadarChartContainer);
44
44
  }
45
45
  static get observedAttributes() {
46
- return [
47
- "abilitys",
48
- "colorPolygon",
49
- "colorLine",
50
- "fillColor",
51
- "strokeColor"
52
- ];
46
+ return ["abilitys", "colorPolygon", "colorLine", "fillColor", "strokeColor"];
53
47
  }
54
48
  get abilitys() {
55
49
  const item = this.getAttribute("abilitys");
@@ -254,21 +248,9 @@ function Custom() {
254
248
  ctx.fillStyle = color;
255
249
  ctx.moveTo(x + radius, y);
256
250
  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
- );
251
+ ctx.arc(x + width - radius, y + radius, radius, Math.PI * 3 / 2, Math.PI * 2);
264
252
  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
- );
253
+ ctx.arc(x + width - radius, y + height - radius, radius, Math.PI, Math.PI / 2);
272
254
  ctx.lineTo(x + radius, y + height);
273
255
  ctx.arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
274
256
  ctx.lineTo(x, y + radius);
@@ -325,13 +307,7 @@ function Custom() {
325
307
  disconnectCallback() {
326
308
  }
327
309
  attributeChangedCallback(name, oldValue, newValue) {
328
- const attribute = [
329
- "abilitys",
330
- "colorPolygon",
331
- "colorLine",
332
- "fillColor",
333
- "strokeColor"
334
- ];
310
+ const attribute = ["abilitys", "colorPolygon", "colorLine", "fillColor", "strokeColor"];
335
311
  if (attribute.includes(name) && this.abilityRadarChartContainer && oldValue !== newValue) {
336
312
  this.refreshData();
337
313
  }
@@ -0,0 +1,496 @@
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 { H as HTMLElementSSR, i as isDisabled, f as falseList, c as createCustomError } from "./index-CSnBqUsQ.js";
8
+ class Input extends HTMLElementSSR() {
9
+ constructor() {
10
+ super();
11
+ __publicField(this, "_input");
12
+ __publicField(this, "_label");
13
+ __publicField(this, "_inputContent");
14
+ __publicField(this, "_icon");
15
+ /**
16
+ * @description: 原生的input方法
17
+ * @param {Event} event
18
+ */
19
+ __publicField(this, "customInput", (event) => {
20
+ event.stopPropagation();
21
+ event.preventDefault();
22
+ const { target, data = "" } = event;
23
+ this.value = (target == null ? void 0 : target.value) || data || "";
24
+ this.customChange();
25
+ this.dispatchEvent(
26
+ new CustomEvent("input", {
27
+ detail: {
28
+ value: this.value
29
+ }
30
+ })
31
+ );
32
+ });
33
+ /**
34
+ * @description: 增加change方法,同时兼容大小写的情况
35
+ */
36
+ __publicField(this, "customChange", () => {
37
+ this.dispatchEvent(
38
+ new CustomEvent("change", {
39
+ detail: {
40
+ value: this.value
41
+ }
42
+ })
43
+ );
44
+ });
45
+ /**
46
+ * @description: 监听placeholder属性函数
47
+ * @param {string} name
48
+ * @param {string} value
49
+ */
50
+ __publicField(this, "listenPlaceholder", (name, value) => {
51
+ if (name === "placeholder" && this._inputContent) {
52
+ if (value != null) {
53
+ this._inputContent.setAttribute("placeholder", value);
54
+ } else {
55
+ this._inputContent.removeAttribute("placeholder");
56
+ }
57
+ }
58
+ });
59
+ /**
60
+ * @description: 监听label属性函数
61
+ * @param {string} name
62
+ * @param {string} value
63
+ */
64
+ __publicField(this, "listenLabel", (name, value) => {
65
+ if (name === "label" && this._inputContent) {
66
+ if (value != null) {
67
+ if (this._label) {
68
+ this._label.innerHTML = value;
69
+ } else {
70
+ this._label = document.createElement("label");
71
+ this._label.innerHTML = value;
72
+ this._label.setAttribute("class", "ran-input-label");
73
+ this._label.setAttribute("part", "ran-input-label");
74
+ this._input.appendChild(this._label);
75
+ }
76
+ } else {
77
+ this._input.removeAttribute("label");
78
+ if (this._label) {
79
+ this._input.removeChild(this._label);
80
+ this._label = void 0;
81
+ }
82
+ }
83
+ }
84
+ });
85
+ /**
86
+ * @description: 监听type属性
87
+ * @param {string} name
88
+ * @param {string} value
89
+ */
90
+ __publicField(this, "listenType", (name, value) => {
91
+ if (name === "type" && this._inputContent) {
92
+ if (value) {
93
+ this._inputContent.setAttribute("type", value);
94
+ } else {
95
+ this._inputContent.removeAttribute("type");
96
+ this._inputContent.removeAttribute("min");
97
+ this._inputContent.removeAttribute("max");
98
+ this._inputContent.removeAttribute("step");
99
+ }
100
+ }
101
+ });
102
+ /**
103
+ * @description: 监听status属性
104
+ * @param {string} name
105
+ * @param {string} value
106
+ */
107
+ __publicField(this, "listenStatus", (name, value) => {
108
+ if (name === "status" && this._input) {
109
+ if (value) {
110
+ this._input.setAttribute("status", value);
111
+ } else {
112
+ this._input.removeAttribute("status");
113
+ }
114
+ }
115
+ });
116
+ /**
117
+ * @description: 监听disabled属性
118
+ * @param {string} name
119
+ * @param {string} value
120
+ */
121
+ __publicField(this, "listenDisabled", (name, value) => {
122
+ if (name === "disabled" && this._input) {
123
+ if (falseList.includes(value)) {
124
+ this._input.removeAttribute("disabled");
125
+ } else {
126
+ this._input.setAttribute("disabled", "");
127
+ this._inputContent.setAttribute("disabled", "");
128
+ }
129
+ }
130
+ });
131
+ /**
132
+ * @description: 监听icon属性
133
+ * @param {string} name
134
+ * @param {string} value
135
+ */
136
+ __publicField(this, "listenIcon", (name, value, oldValue) => {
137
+ if (name === "icon" && value && value !== oldValue) {
138
+ this.removeAttribute("label");
139
+ this.setAttribute("icon", value);
140
+ this.dealIcon();
141
+ }
142
+ });
143
+ /**
144
+ * @description: 处理icon属性的问题
145
+ */
146
+ __publicField(this, "dealIcon", () => {
147
+ if (!this._icon) {
148
+ this._icon = document.createElement("ra-icon");
149
+ const { width, height } = this._inputContent.getBoundingClientRect();
150
+ const size = Math.min(width, height);
151
+ this._icon.setAttribute("size", `${size}`);
152
+ this._inputContent.insertAdjacentElement("beforebegin", this._icon);
153
+ }
154
+ this.icon && this._icon.setAttribute("name", this.icon);
155
+ });
156
+ /**
157
+ * @description: 聚合监听事件
158
+ * @param {string} name
159
+ * @param {string} oldValue
160
+ * @param {string} newValue
161
+ */
162
+ __publicField(this, "listenEvent", (name, oldValue, newValue) => {
163
+ this.listenPlaceholder(name, newValue);
164
+ this.listenLabel(name, newValue);
165
+ this.listenStatus(name, newValue);
166
+ this.listenDisabled(name, newValue);
167
+ this.listenIcon(name, newValue, oldValue);
168
+ if (name === "value" && oldValue !== newValue) {
169
+ this._inputContent.value = newValue;
170
+ this._input.setAttribute("value", newValue);
171
+ }
172
+ });
173
+ this._input = document.createElement("div");
174
+ this._input.setAttribute("class", "ran-input");
175
+ this._input.setAttribute("part", "ran-input");
176
+ this._inputContent = document.createElement("input");
177
+ this._inputContent.setAttribute("class", "ran-input-content");
178
+ this._inputContent.setAttribute("part", "ran-input-content");
179
+ this._input.appendChild(this._inputContent);
180
+ }
181
+ static get observedAttributes() {
182
+ return [
183
+ "label",
184
+ "disabled",
185
+ "name",
186
+ "placeholder",
187
+ "type",
188
+ "icon",
189
+ "value",
190
+ "status",
191
+ // error warning
192
+ "prefix",
193
+ // 前缀
194
+ "suffix",
195
+ // 后缀
196
+ "allowclear",
197
+ // 清除 icon
198
+ "count",
199
+ // 计算输入的数量
200
+ "maxlength",
201
+ "showcount",
202
+ "onPressEnter",
203
+ // 按下回车的回调
204
+ "variant",
205
+ // filled borderless
206
+ "minrows",
207
+ // 当 type 等于 TextArea 时
208
+ "maxrows"
209
+ ];
210
+ }
211
+ /**
212
+ * @description: 获取input的值
213
+ * @return {String}
214
+ */
215
+ get value() {
216
+ return this.getAttribute("value") || "";
217
+ }
218
+ /**
219
+ * @description: 设置input的值
220
+ * @param {String} value
221
+ */
222
+ set value(value) {
223
+ if (!isDisabled(this) && value) {
224
+ this.setAttribute("value", value);
225
+ this._input.setAttribute("value", value);
226
+ } else {
227
+ this.removeAttribute("value");
228
+ this._input.removeAttribute("value");
229
+ }
230
+ }
231
+ /**
232
+ * @description: 获取input的占位字符
233
+ * @return {String}
234
+ */
235
+ get placeholder() {
236
+ return this.getAttribute("placeholder") || "";
237
+ }
238
+ /**
239
+ * @description: 设置input的占位字符
240
+ * @param {String} value
241
+ */
242
+ set placeholder(value) {
243
+ if (value) {
244
+ this.setAttribute("placeholder", value);
245
+ } else {
246
+ this.removeAttribute("placeholder");
247
+ }
248
+ }
249
+ /**
250
+ * @description: input是否为必选
251
+ * @return {String}
252
+ */
253
+ get required() {
254
+ return this.getAttribute("required") || "";
255
+ }
256
+ /**
257
+ * @description: 设置input是否为必选,除非设置成false,否则都是必填
258
+ * @param {*} value
259
+ */
260
+ set required(value) {
261
+ if (!value || value === "false") {
262
+ this.removeAttribute("required");
263
+ } else {
264
+ this.setAttribute("required", "");
265
+ }
266
+ }
267
+ /**
268
+ * @description: 获取input上disabled属性
269
+ * @return {String | null}
270
+ */
271
+ get disabled() {
272
+ return `${isDisabled(this)}`;
273
+ }
274
+ /**
275
+ * @description: 设置input的disabled属性
276
+ * @param {String} value
277
+ */
278
+ set disabled(value) {
279
+ if (falseList.includes(value)) {
280
+ this.removeAttribute("disabled");
281
+ this._input.removeAttribute("disabled");
282
+ this._inputContent.removeAttribute("disabled");
283
+ } else {
284
+ this.setAttribute("disabled", "");
285
+ this._input.setAttribute("disabled", "");
286
+ this._inputContent.setAttribute("disabled", "");
287
+ }
288
+ }
289
+ /**
290
+ * @description: 获取类似于Metiral Design的输入体验。
291
+ */
292
+ get label() {
293
+ return this.getAttribute("label") || "";
294
+ }
295
+ /**
296
+ * @description: 设置类似于Metiral Design的输入体验。
297
+ */
298
+ set label(value) {
299
+ this.setAttribute("label", value);
300
+ }
301
+ /**
302
+ * @description: 获取input框的状态
303
+ */
304
+ get status() {
305
+ return this.getAttribute("status") || "";
306
+ }
307
+ /**
308
+ * @description: 设置input框的状态
309
+ */
310
+ set status(value) {
311
+ if (value) {
312
+ this.setAttribute("status", value);
313
+ this._input.setAttribute("status", value);
314
+ } else {
315
+ this.removeAttribute("status");
316
+ this._input.removeAttribute("status");
317
+ }
318
+ }
319
+ /**
320
+ * @description: 与form组件联动时,收集的属性名
321
+ * @return {String}
322
+ */
323
+ get name() {
324
+ return this.getAttribute("name") || "";
325
+ }
326
+ /**
327
+ * @description: 设置name属性
328
+ * @param {string} value
329
+ */
330
+ set name(value) {
331
+ this.setAttribute("name", value);
332
+ }
333
+ /**
334
+ * @description: 当input类型为number类型时,可以获取min属性
335
+ * @return {String}
336
+ */
337
+ get min() {
338
+ return this.getAttribute("min") || "";
339
+ }
340
+ /**
341
+ * @description: 当input类型为number类型时,设置min属性
342
+ * @param {string} value
343
+ */
344
+ set min(value) {
345
+ if (this.type === "number")
346
+ this.setAttribute("min", value);
347
+ }
348
+ /**
349
+ * @description: 当input类型为number类型时,可以获取max属性
350
+ * @return {String}
351
+ */
352
+ get max() {
353
+ return this.getAttribute("max") || "";
354
+ }
355
+ /**
356
+ * @description: 当input类型为number类型时,设置max属性
357
+ * @param {string} value
358
+ */
359
+ set max(value) {
360
+ if (this.type === "number")
361
+ this.setAttribute("max", value);
362
+ }
363
+ /**
364
+ * @description: 当input类型为number类型时,可以获取step属性
365
+ * @return {String}
366
+ */
367
+ get step() {
368
+ return this.getAttribute("step") || "";
369
+ }
370
+ /**
371
+ * @description: 当input类型为number类型时,设置step属性
372
+ * @param {string} value
373
+ */
374
+ set step(value) {
375
+ if (this.type === "number")
376
+ this.setAttribute("step", value);
377
+ }
378
+ /**
379
+ * @description: 获取一个icon
380
+ * @return {String}
381
+ */
382
+ get icon() {
383
+ return this.getAttribute("icon") || "";
384
+ }
385
+ /**
386
+ * @description: 设置icon来表示标识
387
+ * @param {string|null} value
388
+ */
389
+ set icon(value) {
390
+ if (value) {
391
+ this.setAttribute("icon", value);
392
+ } else {
393
+ this.removeAttribute("icon");
394
+ }
395
+ }
396
+ /**
397
+ * @description: 获取前面的icon
398
+ * @return {String}
399
+ */
400
+ get prefix() {
401
+ return this.getAttribute("prefix") || "";
402
+ }
403
+ /**
404
+ * @description: 设置前面的icon来表示标识
405
+ * @param {string|null} value
406
+ */
407
+ set prefix(value) {
408
+ if (value) {
409
+ this.setAttribute("prefix", value);
410
+ } else {
411
+ this.removeAttribute("prefix");
412
+ }
413
+ }
414
+ /**
415
+ * @description: 获取后面的icon
416
+ * @return {String}
417
+ */
418
+ get suffix() {
419
+ return this.getAttribute("suffix") || "";
420
+ }
421
+ /**
422
+ * @description: 设置后面的icon来表示标识
423
+ * @param {string|null} value
424
+ */
425
+ set suffix(value) {
426
+ if (value) {
427
+ this.setAttribute("suffix", value);
428
+ } else {
429
+ this.removeAttribute("suffix");
430
+ }
431
+ }
432
+ /**
433
+ * @description: 获取input的类型
434
+ * @return {string|null}
435
+ */
436
+ get type() {
437
+ return this.getAttribute("type") || "";
438
+ }
439
+ /**
440
+ * @description: 设置input的类型
441
+ * @param {string|null} value
442
+ */
443
+ set type(value) {
444
+ if (value) {
445
+ this.setAttribute("type", value);
446
+ } else {
447
+ this.removeAttribute("type");
448
+ }
449
+ }
450
+ connectedCallback() {
451
+ if (this.value) {
452
+ this._inputContent.value = this.value;
453
+ this._input.setAttribute("value", this.value);
454
+ }
455
+ if (this.status) {
456
+ this._input.setAttribute("status", this.status);
457
+ }
458
+ if (isDisabled(this)) {
459
+ this._input.setAttribute("disabled", "");
460
+ this._inputContent.setAttribute("disabled", "");
461
+ }
462
+ if (this.type) {
463
+ this._inputContent.setAttribute("type", this.type);
464
+ }
465
+ this._inputContent.addEventListener("input", this.customInput);
466
+ if (document.readyState === "complete") {
467
+ this.dealIcon();
468
+ }
469
+ this.appendChild(this._input);
470
+ }
471
+ disconnectCallback() {
472
+ this._inputContent.removeEventListener("input", this.customInput);
473
+ }
474
+ attributeChangedCallback(name, oldValue, newValue) {
475
+ this.listenEvent(name, oldValue, newValue);
476
+ }
477
+ }
478
+ function Custom() {
479
+ if (typeof window !== "undefined" && !customElements.get("ra-input")) {
480
+ customElements.define("ra-input", Input);
481
+ return Input;
482
+ } else {
483
+ return createCustomError("document is undefined or ra-input is exist");
484
+ }
485
+ }
486
+ const index = Custom();
487
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
488
+ __proto__: null,
489
+ Input,
490
+ default: index
491
+ }, Symbol.toStringTag, { value: "Module" }));
492
+ export {
493
+ Input as I,
494
+ index as a,
495
+ index$1 as i
496
+ };