ranui 0.1.9 → 0.1.10-alpha.10

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 (198) hide show
  1. package/README.zh-CN.md +190 -0
  2. package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +12 -0
  3. package/dist/arrow-down-B_hCY3Wt.js +662 -0
  4. package/dist/button.js +7 -0
  5. package/dist/checkbox.js +7 -0
  6. package/dist/colorpicker.js +11 -0
  7. package/dist/{colz-746223ab.js → colz-DJZvo_8B.js} +4 -13
  8. package/dist/docx-CHkPTdGU.js +3665 -0
  9. package/dist/drop-4j4abxje.js +36 -0
  10. package/dist/icon.js +6 -0
  11. package/dist/iconShadowless.js +6 -0
  12. package/dist/image.js +4 -0
  13. package/dist/{index-4443363f.js → index-15M0olqa.js} +40 -68
  14. package/dist/index-1v568_nq.js +140 -0
  15. package/dist/index-B897keW5.js +279 -0
  16. package/dist/{index-e03d23e7.js → index-BZR0HaP2.js} +2 -5
  17. package/dist/{index-e2e5d725.js → index-B_GuEcTd.js} +1280 -2146
  18. package/dist/index-Bc2Bcl8D.js +63701 -0
  19. package/dist/index-C4Sv0T51.js +495 -0
  20. package/dist/{index-2d16a084.js → index-C6RcMHoH.js} +12 -22
  21. package/dist/index-C9z10IgG.js +103 -0
  22. package/dist/{index-3cf72afd.js → index-CFjEuvBW.js} +23 -45
  23. package/dist/{index-7b8840f9.js → index-CGEx9VOA.js} +1086 -2670
  24. package/dist/index-CGYfjKUV.js +72 -0
  25. package/dist/index-CVtBLEpV.js +712 -0
  26. package/dist/index-CiWwvEMM.js +511 -0
  27. package/dist/index-CtVOgBDk.js +659 -0
  28. package/dist/index-D4qUro5V.js +279 -0
  29. package/dist/index-D4y9c1Dj.js +310 -0
  30. package/dist/{index-b7790662.js → index-DAxs7Dd2.js} +6 -13
  31. package/dist/index-DC5EA657.js +91 -0
  32. package/dist/index-DJZmDHz-.js +146 -0
  33. package/dist/{index-0d5b9435.js → index-D_CA5VDZ.js} +11 -15
  34. package/dist/{index-01b17e26.js → index-KS2nvVcO.js} +2 -5
  35. package/dist/{index-1048a998.js → index-WfFw4LJT.js} +105 -62
  36. package/dist/{index-458debf7.js → index-mhFL9MJp.js} +15 -49
  37. package/dist/index.d.ts +211 -14
  38. package/dist/index.js +24 -24
  39. package/dist/info-circle-fill-CFeVMdci.js +4 -0
  40. package/dist/input.js +6 -0
  41. package/dist/inputShadowless.js +6 -0
  42. package/dist/jszip.min-Dhs3nUkD.js +2346 -0
  43. package/dist/katex-es-B5r5vt3m.js +14628 -0
  44. package/dist/loading-scene-BMc2wqKm.js +4 -0
  45. package/dist/loading.js +8 -0
  46. package/dist/math.js +7 -0
  47. package/dist/message.js +6 -0
  48. package/dist/modal.js +4 -0
  49. package/dist/{pdf-bdb7818a.js → pdf-Cx0VWKFo.js} +13 -8
  50. package/dist/player.js +8 -0
  51. package/dist/popover.js +8 -0
  52. package/dist/preview.js +7 -0
  53. package/dist/progress.js +7 -0
  54. package/dist/radar.js +6 -0
  55. package/dist/select.js +10 -0
  56. package/dist/{index-1b73beee.js → selectShadowless.js} +161 -165
  57. package/dist/shadowless.js +8 -0
  58. package/dist/skeleton.js +4 -0
  59. package/dist/sprite-CH2zLtZy.js +141 -0
  60. package/dist/style.css +1 -1
  61. package/dist/tab.js +6 -0
  62. package/dist/tabpane.js +4 -0
  63. package/dist/tsconfig.json +31 -0
  64. package/dist/typings.d.ts +211 -0
  65. package/dist/umd/index.umd.cjs +21 -32
  66. package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
  67. package/dist/umd/shadowless/style.css +1 -0
  68. package/dist/umd/style.css +1 -1
  69. package/package.json +113 -69
  70. package/readme.md +38 -56
  71. package/typings.d.ts +211 -0
  72. package/dist/build/config.d.ts +0 -3
  73. package/dist/build/config.es.d.ts +0 -2
  74. package/dist/build/config.umd.d.ts +0 -2
  75. package/dist/components/button/index.d.ts +0 -35
  76. package/dist/components/button/index.js +0 -8
  77. package/dist/components/form/index.d.ts +0 -2
  78. package/dist/components/icon/index.d.ts +0 -2
  79. package/dist/components/icon/index.js +0 -6
  80. package/dist/components/image/index.d.ts +0 -2
  81. package/dist/components/image/index.js +0 -4
  82. package/dist/components/input/index.d.ts +0 -185
  83. package/dist/components/input/index.js +0 -6
  84. package/dist/components/message/index.d.ts +0 -14
  85. package/dist/components/message/index.js +0 -4
  86. package/dist/components/modal/index.d.ts +0 -2
  87. package/dist/components/modal/index.js +0 -4
  88. package/dist/components/option/index.d.ts +0 -2
  89. package/dist/components/option/index.js +0 -95
  90. package/dist/components/player/index.d.ts +0 -213
  91. package/dist/components/player/index.js +0 -12
  92. package/dist/components/preview/colz.d.ts +0 -72
  93. package/dist/components/preview/docx.d.ts +0 -8
  94. package/dist/components/preview/excel/excel.d.ts +0 -2
  95. package/dist/components/preview/excel/index.d.ts +0 -1
  96. package/dist/components/preview/excel/media.d.ts +0 -37
  97. package/dist/components/preview/index.d.ts +0 -6
  98. package/dist/components/preview/index.js +0 -8
  99. package/dist/components/preview/pdf.d.ts +0 -1
  100. package/dist/components/preview/pptx/index.d.ts +0 -16
  101. package/dist/components/preview/pptx/process_pptx.d.ts +0 -23
  102. package/dist/components/preview/pptx/t_xml.d.ts +0 -1
  103. package/dist/components/preview/pptx/worker.d.ts +0 -1
  104. package/dist/components/progress/index.d.ts +0 -36
  105. package/dist/components/progress/index.js +0 -8
  106. package/dist/components/radar/index.d.ts +0 -2
  107. package/dist/components/radar/index.js +0 -7
  108. package/dist/components/scratch/index.d.ts +0 -19
  109. package/dist/components/select/index.d.ts +0 -105
  110. package/dist/components/select/index.js +0 -11
  111. package/dist/components/skeleton/index.d.ts +0 -2
  112. package/dist/components/skeleton/index.js +0 -4
  113. package/dist/components/tab/index.d.ts +0 -408
  114. package/dist/components/tab/index.js +0 -7
  115. package/dist/components/tabpane/index.d.ts +0 -352
  116. package/dist/components/tabpane/index.js +0 -4
  117. package/dist/docx-c5d02d8c.js +0 -21
  118. package/dist/index-57492b9b.js +0 -48
  119. package/dist/index-7216d6b0.js +0 -175
  120. package/dist/index-73ce455b.js +0 -264
  121. package/dist/index-7913ec46.js +0 -239
  122. package/dist/index-c14450a9.js +0 -662
  123. package/dist/info-circle-fill-90ec9aa9.js +0 -14
  124. package/dist/playwright.config.d.ts +0 -9
  125. package/dist/plugins/auto-import-file.d.ts +0 -0
  126. package/dist/plugins/load-style.d.ts +0 -6
  127. package/dist/plugins/load-svg.d.ts +0 -9
  128. package/dist/tests/button.spec.d.ts +0 -1
  129. package/dist/umd/build/config.d.ts +0 -3
  130. package/dist/umd/build/config.es.d.ts +0 -2
  131. package/dist/umd/build/config.umd.d.ts +0 -2
  132. package/dist/umd/components/button/index.d.ts +0 -35
  133. package/dist/umd/components/form/index.d.ts +0 -2
  134. package/dist/umd/components/icon/index.d.ts +0 -2
  135. package/dist/umd/components/image/index.d.ts +0 -2
  136. package/dist/umd/components/input/index.d.ts +0 -185
  137. package/dist/umd/components/message/index.d.ts +0 -14
  138. package/dist/umd/components/modal/index.d.ts +0 -2
  139. package/dist/umd/components/option/index.d.ts +0 -2
  140. package/dist/umd/components/player/index.d.ts +0 -213
  141. package/dist/umd/components/preview/colz.d.ts +0 -72
  142. package/dist/umd/components/preview/docx.d.ts +0 -8
  143. package/dist/umd/components/preview/excel/excel.d.ts +0 -2
  144. package/dist/umd/components/preview/excel/index.d.ts +0 -1
  145. package/dist/umd/components/preview/excel/media.d.ts +0 -37
  146. package/dist/umd/components/preview/index.d.ts +0 -6
  147. package/dist/umd/components/preview/pdf.d.ts +0 -1
  148. package/dist/umd/components/preview/pptx/index.d.ts +0 -16
  149. package/dist/umd/components/preview/pptx/process_pptx.d.ts +0 -23
  150. package/dist/umd/components/preview/pptx/t_xml.d.ts +0 -1
  151. package/dist/umd/components/preview/pptx/worker.d.ts +0 -1
  152. package/dist/umd/components/progress/index.d.ts +0 -36
  153. package/dist/umd/components/radar/index.d.ts +0 -2
  154. package/dist/umd/components/scratch/index.d.ts +0 -19
  155. package/dist/umd/components/select/index.d.ts +0 -105
  156. package/dist/umd/components/skeleton/index.d.ts +0 -2
  157. package/dist/umd/components/tab/index.d.ts +0 -408
  158. package/dist/umd/components/tabpane/index.d.ts +0 -352
  159. package/dist/umd/index.d.ts +0 -14
  160. package/dist/umd/playwright.config.d.ts +0 -9
  161. package/dist/umd/plugins/auto-import-file.d.ts +0 -0
  162. package/dist/umd/plugins/load-style.d.ts +0 -6
  163. package/dist/umd/plugins/load-svg.d.ts +0 -9
  164. package/dist/umd/tests/button.spec.d.ts +0 -1
  165. package/dist/umd/utils/image.d.ts +0 -32
  166. package/dist/umd/utils/index.d.ts +0 -64
  167. package/dist/umd/utils/math.d.ts +0 -26
  168. package/dist/umd/utils/tween.d.ts +0 -21
  169. package/dist/umd/vite.config.d.ts +0 -6
  170. package/dist/utils/image.d.ts +0 -32
  171. package/dist/utils/index.d.ts +0 -64
  172. package/dist/utils/math.d.ts +0 -26
  173. package/dist/utils/tween.d.ts +0 -21
  174. package/dist/vendor-f71e6f68.js +0 -92126
  175. package/dist/vite.config.d.ts +0 -6
  176. /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
  177. /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
  178. /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
  179. /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
  180. /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
  181. /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
  182. /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
  183. /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
  184. /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
  185. /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
  186. /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
  187. /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
  188. /package/dist/{loading-09ca52df.js → loading-Dcc5RApI.js} +0 -0
  189. /package/dist/{lock-1d2487c9.js → lock-Cr7BnmWN.js} +0 -0
  190. /package/dist/{message-b2bfdea7.js → message-D36_Zo2l.js} +0 -0
  191. /package/dist/{power-off-6ade5a91.js → power-off-lQRbiBak.js} +0 -0
  192. /package/dist/{preview-b291aea8.js → preview-CJbz9GjO.js} +0 -0
  193. /package/dist/{setting-1e5ccb6d.js → setting-DemlgzVC.js} +0 -0
  194. /package/dist/{team-ca6a12e1.js → team-tl4NJXPC.js} +0 -0
  195. /package/dist/{unlock-f56086fd.js → unlock-CeU74z9n.js} +0 -0
  196. /package/dist/{user-5c01e665.js → user-B-eVXwuk.js} +0 -0
  197. /package/dist/{warning-circle-035e025c.js → warning-circle-DDUgEDIv.js} +0 -0
  198. /package/dist/{warning-circle-fill-d17c37c9.js → warning-circle-fill-lODUKz0i.js} +0 -0
package/dist/player.js ADDED
@@ -0,0 +1,8 @@
1
+ import "./arrow-down-B_hCY3Wt.js";
2
+ import { R, a } from "./index-B_GuEcTd.js";
3
+ import "./index-CtVOgBDk.js";
4
+ import "./index-DC5EA657.js";
5
+ export {
6
+ R as RanPlayer,
7
+ a as default
8
+ };
@@ -0,0 +1,8 @@
1
+ import { P, a } from "./index-D4y9c1Dj.js";
2
+ import "./arrow-down-B_hCY3Wt.js";
3
+ import "./index-DC5EA657.js";
4
+ import "./index-C9z10IgG.js";
5
+ export {
6
+ P as Popover,
7
+ a as default
8
+ };
@@ -0,0 +1,7 @@
1
+ import { a } from "./index-B897keW5.js";
2
+ import "./arrow-down-B_hCY3Wt.js";
3
+ import "./index-D4qUro5V.js";
4
+ import "./index-D_CA5VDZ.js";
5
+ export {
6
+ a as default
7
+ };
@@ -0,0 +1,7 @@
1
+ import { P, a } from "./index-15M0olqa.js";
2
+ import "./arrow-down-B_hCY3Wt.js";
3
+ import "./index-DC5EA657.js";
4
+ export {
5
+ P as Progress,
6
+ a as default
7
+ };
package/dist/radar.js ADDED
@@ -0,0 +1,6 @@
1
+ import { a } from "./index-mhFL9MJp.js";
2
+ import "./arrow-down-B_hCY3Wt.js";
3
+ import "./index-DC5EA657.js";
4
+ export {
5
+ a as default
6
+ };
package/dist/select.js ADDED
@@ -0,0 +1,10 @@
1
+ import { S, a } from "./index-CtVOgBDk.js";
2
+ import "./arrow-down-B_hCY3Wt.js";
3
+ import "./index-DC5EA657.js";
4
+ import "./index-C9z10IgG.js";
5
+ import "./index-D4qUro5V.js";
6
+ import "./index-C4Sv0T51.js";
7
+ export {
8
+ S as Select,
9
+ a as default
10
+ };
@@ -1,15 +1,87 @@
1
1
  var __defProp = Object.defineProperty;
2
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, i as isMobile, b as generateThrottle } from "./index-7913ec46.js";
8
- import { i as isDisabled, c as createCustomError } from "./index-57492b9b.js";
9
- import "./components/option/index.js";
10
- import "./index-7216d6b0.js";
11
- import "./index-1048a998.js";
12
- 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}:host{position:relative;display:inline-block;cursor:pointer;height:32px;outline:0;-webkit-tap-highlight-color:transparent}:host,:host(:focus),:host(:active){outline:0;-webkit-tap-highlight-color:transparent}:host ::slotted(r-option){display:none}:host([disabled]){cursor:not-allowed;pointer-events:all;opacity:.6}:host([type="text"])::part(selection){border:none}:host([type="text"])::part(icon){display:none}:host(:not([disabled]):hover) .select{cursor:pointer}:host(:not([disabled]):hover) .selection{border:1px solid #1890ff}:host(:not([disabled]):hover) .selection-search{cursor:pointer}:host(:not([disabled]):hover) .selection-item{cursor:pointer;color:#bfbfbf}:host(:not([disabled]):focus) .selection{border:1px solid #1890ff}:host(:not([disabled]):focus) .selection-search{cursor:pointer}:host(:not([disabled]):focus) .selection-item{cursor:pointer;color:#bfbfbf}:host .selection-search{display:none}:host([showSearch]:not([disabled])) .selection-search{cursor:text;display:block}:host([showSearch]:not([disabled])) .selection-item{cursor:pointer}:host([showSearch]:not([disabled]):focus) .selection-search{display:block;cursor:text;opacity:1}.ran-select{width:100%;height:100%;box-sizing:border-box;margin:0;padding:0;color:#000000e0;font-size:14px;line-height:1.57142857;list-style:none;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";position:relative;display:inline-block}.ran-select .selection{position:relative;background-color:#fff;border:1px solid #d9d9d9;transition:all .2s cubic-bezier(.645,.045,.355,1);width:100%;height:100%;padding:0 11px;box-sizing:border-box;margin:0;color:#000000e0;font-size:14px;line-height:1.57142857;list-style:none;font-family:inherit;display:flex;border-radius:6px}.ran-select .selection-search{position:absolute;top:0;left:0;height:100%;inset-inline-start:11px;inset-inline-end:11px;opacity:0;margin:0;padding:0;background:transparent;border:none;outline:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-family:inherit;cursor:not-allowed}.ran-select .selection-search::-webkit-search-cancel-button{display:none;-webkit-appearance:none}.ran-select .selection-search::part(ran-input){border:none;padding:0;height:100%;outline:none}.ran-select .selection-search::part(ran-input):active{border:none;padding:0;height:100%;outline:none;border-color:transparent;box-shadow:none;border-right-width:0px}.ran-select .selection-item{position:absolute;top:0;left:12px;margin:0;padding:0;background:transparent;border:none;outline:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-family:inherit;height:100%;-webkit-user-select:none;user-select:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer}.ran-select .selection-select{color:#00000040}.ran-select .selection .icon{display:flex;align-items:center;color:#00000040;font-style:normal;text-align:center;text-transform:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;top:50%;inset-inline-start:auto;inset-inline-end:8px;height:12px;margin-top:-3px;font-size:12px;pointer-events:none}\n';
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import "./index-DJZmDHz-.js";
5
+ import "./index-WfFw4LJT.js";
6
+ import { a as addClassToElement, r as removeClassToElement, i as isMobile, f as generateThrottle } from "./arrow-down-B_hCY3Wt.js";
7
+ import { c as createCustomError, i as isDisabled, H as HTMLElementSSR } from "./index-DC5EA657.js";
8
+ function Custom$1() {
9
+ if (typeof document !== "undefined" && !customElements.get("ra-option")) {
10
+ class Option extends HTMLElement {
11
+ constructor() {
12
+ super();
13
+ __publicField(this, "_option");
14
+ __publicField(this, "_optionContent");
15
+ __publicField(this, "_shadowDom");
16
+ __publicField(this, "_slot");
17
+ this._slot = document.createElement("slot");
18
+ this._option = document.createElement("div");
19
+ this._option.setAttribute("class", "ran-option");
20
+ this._optionContent = document.createElement("div");
21
+ this._optionContent.setAttribute("class", "ran-option-content");
22
+ this._optionContent.appendChild(this._slot);
23
+ this._option.appendChild(this._optionContent);
24
+ const shadowRoot = this.attachShadow({ mode: "closed" });
25
+ this._shadowDom = shadowRoot;
26
+ shadowRoot.appendChild(this._option);
27
+ }
28
+ static get observedAttributes() {
29
+ return ["disabled", "sheet", "value"];
30
+ }
31
+ get value() {
32
+ return this.getAttribute("value");
33
+ }
34
+ set value(value) {
35
+ this.setAttribute("value", value || "");
36
+ }
37
+ get sheet() {
38
+ return this.getAttribute("sheet");
39
+ }
40
+ set sheet(value) {
41
+ this.setAttribute("sheet", value || "");
42
+ }
43
+ get disabled() {
44
+ return isDisabled(this);
45
+ }
46
+ set disabled(value) {
47
+ if (!value || value === "false") {
48
+ this.removeAttribute("disabled");
49
+ } else {
50
+ this.setAttribute("disabled", "");
51
+ }
52
+ }
53
+ handlerExternalCss() {
54
+ if (this.sheet) {
55
+ try {
56
+ const sheet = new CSSStyleSheet();
57
+ sheet.insertRule(this.sheet);
58
+ this._shadowDom.adoptedStyleSheets = [sheet];
59
+ } catch (error) {
60
+ console.error(`Failed to parse the rule in CSSStyleSheet: ${this.sheet}`);
61
+ }
62
+ }
63
+ }
64
+ connectedCallback() {
65
+ }
66
+ disconnectCallback() {
67
+ }
68
+ attributeChangedCallback(name, oldValue, newValue) {
69
+ if (name === "disabled" && this._option) {
70
+ if (!newValue || newValue === "false") {
71
+ this._option.setAttribute("disabled", "");
72
+ } else {
73
+ this._option.removeAttribute("disabled");
74
+ }
75
+ }
76
+ if (name === "sheet" && this._shadowDom && oldValue !== newValue) this.handlerExternalCss();
77
+ }
78
+ }
79
+ return Option;
80
+ } else {
81
+ return createCustomError("document is undefined or ra-option is exist");
82
+ }
83
+ }
84
+ Custom$1();
13
85
  const placementDirection = {
14
86
  bottom: {
15
87
  add: "ran-select-dropdown-down-in",
@@ -21,12 +93,10 @@ const placementDirection = {
21
93
  }
22
94
  };
23
95
  const searchThrottle = generateThrottle();
24
- class Select extends HTMLElement {
96
+ class Select extends HTMLElementSSR() {
25
97
  constructor() {
26
98
  super();
27
99
  __publicField(this, "removeTimeId");
28
- __publicField(this, "_slot");
29
- __publicField(this, "_shadowDom");
30
100
  __publicField(this, "_select");
31
101
  __publicField(this, "_selection");
32
102
  __publicField(this, "_search");
@@ -47,20 +117,13 @@ class Select extends HTMLElement {
47
117
  * @return {*}
48
118
  */
49
119
  __publicField(this, "setSelectDropdownDisplayNone", () => {
50
- if (this._selectDropDownOutTimeId)
51
- return;
120
+ if (this._selectDropDownOutTimeId) return;
52
121
  if (this._selectionDropdown && this._selectionDropdown.style.display !== "none") {
53
- addClassToElement(
54
- this._selectionDropdown,
55
- placementDirection[this.placement].remove
56
- );
122
+ addClassToElement(this._selectionDropdown, placementDirection[this.placement].remove);
57
123
  this._selectDropDownOutTimeId = setTimeout(() => {
58
124
  var _a;
59
125
  (_a = this._selectionDropdown) == null ? void 0 : _a.style.setProperty("display", "none");
60
- this._selectionDropdown && removeClassToElement(
61
- this._selectionDropdown,
62
- placementDirection[this.placement].remove
63
- );
126
+ this._selectionDropdown && removeClassToElement(this._selectionDropdown, placementDirection[this.placement].remove);
64
127
  clearTimeout(this._selectDropDownOutTimeId);
65
128
  this._selectDropDownOutTimeId = void 0;
66
129
  }, 300);
@@ -72,60 +135,47 @@ class Select extends HTMLElement {
72
135
  */
73
136
  __publicField(this, "setSelectDropdownDisplayBlock", () => {
74
137
  var _a;
75
- if (this._selectDropDownInTimeId)
76
- return;
138
+ if (this._selectDropDownInTimeId) return;
77
139
  if (this._selectionDropdown && this._selectionDropdown.style.display !== "block") {
78
- addClassToElement(
79
- this._selectionDropdown,
80
- placementDirection[this.placement].add
81
- );
140
+ addClassToElement(this._selectionDropdown, placementDirection[this.placement].add);
82
141
  (_a = this._selectionDropdown) == null ? void 0 : _a.style.setProperty("display", "block");
83
142
  this._selectDropDownInTimeId = setTimeout(() => {
84
- this._selectionDropdown && removeClassToElement(
85
- this._selectionDropdown,
86
- placementDirection[this.placement].add
87
- );
143
+ this._selectionDropdown && removeClassToElement(this._selectionDropdown, placementDirection[this.placement].add);
88
144
  clearTimeout(this._selectDropDownInTimeId);
89
145
  this._selectDropDownInTimeId = void 0;
90
146
  }, 200);
91
147
  }
92
148
  });
93
149
  __publicField(this, "placementPosition", () => {
94
- if (!this._selectionDropdown || !this._selectDropdown)
95
- return;
150
+ if (!this._selectionDropdown || !this._selectDropdown) return;
96
151
  const rect = this.getBoundingClientRect();
97
152
  const { top, left, bottom, width, height, x, y, right } = rect;
98
- this._selectionDropdown.style.setProperty(
99
- "-ran-x",
100
- `${x + window.scrollX}`
101
- );
102
- this._selectionDropdown.style.setProperty(
103
- "-ran-y",
104
- `${y + window.scrollY}`
105
- );
153
+ const root = document.getElementById(this.getPopupContainerId);
154
+ this._selectionDropdown.style.setProperty("--ran-x", `${top + window.scrollX}`);
155
+ this._selectionDropdown.style.setProperty("--ran-y", `${left + window.scrollY}`);
106
156
  let selectTop = bottom + window.scrollY;
107
157
  let selectLeft = left + window.scrollX;
108
158
  this._selectionDropdown.style.setProperty("width", `${width}px`);
109
- const root = document.getElementById(this.getPopupContainerId);
110
159
  if (this.placement === "top") {
111
160
  selectTop = top + window.scrollY - this._selectionDropdown.clientHeight;
112
- if (this.getPopupContainerId && root) {
161
+ }
162
+ if (this.getPopupContainerId && root) {
163
+ if (this.placement === "top") {
113
164
  selectTop = top - root.getBoundingClientRect().top - this._selectionDropdown.clientHeight;
114
- selectLeft = left - root.getBoundingClientRect().left;
165
+ } else {
166
+ selectTop = root.getBoundingClientRect().height;
115
167
  }
168
+ selectLeft = 0;
116
169
  }
117
- this._selectionDropdown.style.setProperty(
118
- "inset",
119
- `${selectTop}px auto auto ${selectLeft}px`
120
- );
170
+ this._selectionDropdown.style.setProperty("inset", `${selectTop}px auto auto ${selectLeft}px`);
121
171
  });
122
172
  /**
123
173
  * @description: 设置下拉框
124
174
  * @return {*}
125
175
  */
126
- __publicField(this, "selectMouseDown", () => {
127
- if (isDisabled(this))
128
- return;
176
+ __publicField(this, "selectMouseDown", (e) => {
177
+ e.stopPropagation();
178
+ if (isDisabled(this)) return;
129
179
  this.removeDropDownTimeId();
130
180
  this.setSelectDropdownDisplayNone();
131
181
  this.setSelectDropdownDisplayBlock();
@@ -133,13 +183,13 @@ class Select extends HTMLElement {
133
183
  });
134
184
  __publicField(this, "removeDropDownTimeId", () => {
135
185
  this._search.setAttribute("value", "");
136
- if (this.action.includes("hover") && !isMobile()) {
186
+ if (this.trigger.includes("hover") && !isMobile()) {
137
187
  clearTimeout(this.removeTimeId);
138
188
  this.removeTimeId = void 0;
139
189
  }
140
190
  });
141
191
  /**
142
- * @description: 焦点移除的情况,需要移除select 下拉框
192
+ * @description: 焦点移除的情况,需要移除 select 下拉框
143
193
  * @return {*}
144
194
  */
145
195
  __publicField(this, "selectBlur", () => {
@@ -149,7 +199,7 @@ class Select extends HTMLElement {
149
199
  this.removeTimeId = setTimeout(() => {
150
200
  this.removeDropDownTimeId();
151
201
  this.setSelectDropdownDisplayNone();
152
- }, 300);
202
+ }, 100);
153
203
  });
154
204
  /**
155
205
  * @description: 选中一个选项的情况
@@ -158,12 +208,12 @@ class Select extends HTMLElement {
158
208
  */
159
209
  __publicField(this, "clickOption", (e) => {
160
210
  var _a, _b;
211
+ e.stopPropagation();
161
212
  let element = e.target;
162
213
  if ((_a = element.classList) == null ? void 0 : _a.contains("ranui-select-dropdown-option-item")) {
163
214
  element = element.children[0];
164
215
  }
165
- if (!((_b = element.classList) == null ? void 0 : _b.contains("ranui-select-dropdown-option-item-content")))
166
- return;
216
+ if (!((_b = element.classList) == null ? void 0 : _b.contains("ranui-select-dropdown-option-item-content"))) return;
167
217
  const label = element.innerHTML;
168
218
  const value = this._optionLabelMapValue.get(label);
169
219
  if (value) {
@@ -176,18 +226,12 @@ class Select extends HTMLElement {
176
226
  const { height } = rect;
177
227
  this._text.style.setProperty("line-height", `${height}px`);
178
228
  if (this._activeOption) {
179
- removeClassToElement(
180
- this._activeOption,
181
- "ranui-select-dropdown-option-active"
182
- );
229
+ removeClassToElement(this._activeOption, "ranui-select-dropdown-option-active");
183
230
  }
184
231
  setTimeout(() => {
185
232
  this._activeOption = (element == null ? void 0 : element.parentElement) || void 0;
186
233
  if (this._activeOption) {
187
- addClassToElement(
188
- this._activeOption,
189
- "ranui-select-dropdown-option-active"
190
- );
234
+ addClassToElement(this._activeOption, "ranui-select-dropdown-option-active");
191
235
  }
192
236
  }, 200);
193
237
  this.setSelectDropdownDisplayNone();
@@ -200,39 +244,29 @@ class Select extends HTMLElement {
200
244
  */
201
245
  __publicField(this, "createOption", () => {
202
246
  if (!this._selectDropdown) {
247
+ this.appendChild(this._select);
203
248
  const container = document.getElementById(this.getPopupContainerId) || document.body;
204
249
  this._selectDropdown = document.createElement("div");
205
- this._selectDropdown.style.setProperty(
206
- "-webkit-tap-highlight-color",
207
- "transparent"
208
- );
250
+ this._selectDropdown.style.setProperty("-webkit-tap-highlight-color", "transparent");
209
251
  this._selectDropdown.style.setProperty("outline", "0");
210
252
  this._selectDropdown.addEventListener("click", this.clickOption);
211
253
  this._selectionDropdown = document.createElement("div");
212
- this._selectionDropdown.style.setProperty(
213
- "-webkit-tap-highlight-color",
214
- "transparent"
215
- );
254
+ this._selectionDropdown.style.setProperty("-webkit-tap-highlight-color", "transparent");
216
255
  this._selectionDropdown.style.setProperty("outline", "0");
217
256
  if (this.dropdownclass) {
218
- this._selectionDropdown.setAttribute(
219
- "class",
220
- `${this.dropdownclass} ranui-select-dropdown`
221
- );
257
+ this._selectionDropdown.setAttribute("class", `${this.dropdownclass} ranui-select-dropdown`);
222
258
  } else {
223
259
  this._selectionDropdown.setAttribute("class", "ranui-select-dropdown");
224
260
  }
225
- if (this.action.includes("hover") && !isMobile()) {
261
+ if (this.trigger.includes("hover") && !isMobile()) {
226
262
  this._selectDropdown.addEventListener("mouseleave", this.selectBlur);
227
- this._selectDropdown.addEventListener(
228
- "mouseenter",
229
- this.removeDropDownTimeId
230
- );
263
+ this._selectDropdown.addEventListener("mouseenter", this.removeDropDownTimeId);
231
264
  }
232
265
  this._selectDropdown.appendChild(this._selectionDropdown);
233
266
  this._selectionDropdown.style.setProperty("display", "none");
234
267
  container.appendChild(this._selectDropdown);
235
268
  }
269
+ this.addOptionToSlot();
236
270
  });
237
271
  /**
238
272
  * @description: 移除选项下拉框
@@ -248,27 +282,22 @@ class Select extends HTMLElement {
248
282
  }
249
283
  });
250
284
  /**
251
- * @description: 当select中有option元素的时候,给dropdown添加元素
285
+ * @description: 当 select 中有 option 元素的时候,给 dropdown 添加元素
252
286
  * @return {*}
253
287
  */
254
288
  __publicField(this, "addOptionToSlot", () => {
255
- const slots = this._slot.assignedElements();
256
- slots.forEach((item) => {
257
- var _a;
258
- if (item.tagName !== "R-OPTION")
259
- return;
260
- const label = item.innerHTML;
261
- const value = item.getAttribute("value") || "";
262
- (_a = this._optionList) == null ? void 0 : _a.push({ label, value });
263
- if (this._optionLabelMapValue.get(label)) {
264
- console.warn(`${label} is repeat option`);
265
- }
266
- if (this._optionValueMapLabel.get(value)) {
267
- console.warn(`${value} is repeat option`);
289
+ var _a;
290
+ const child = this.children || [];
291
+ this._optionList = [];
292
+ for (const item of child) {
293
+ if (item.tagName === "R-OPTION") {
294
+ const label = item.innerHTML;
295
+ const value = item.getAttribute("value") || "";
296
+ (_a = this._optionList) == null ? void 0 : _a.push({ label, value });
297
+ this._optionLabelMapValue.set(label, value);
298
+ this._optionValueMapLabel.set(value, label);
268
299
  }
269
- this._optionLabelMapValue.set(label, value);
270
- this._optionValueMapLabel.set(value, label);
271
- });
300
+ }
272
301
  this.createSelectDropdownContent(this._optionList);
273
302
  });
274
303
  __publicField(this, "createSelectDropdownContent", (options = []) => {
@@ -278,6 +307,9 @@ class Select extends HTMLElement {
278
307
  } else {
279
308
  (_b = this._selectDropdown) == null ? void 0 : _b.style.setProperty("display", "block");
280
309
  }
310
+ if (this._selectionDropdown) {
311
+ this._selectionDropdown.innerHTML = "";
312
+ }
281
313
  options.forEach((item) => {
282
314
  if (this._selectionDropdown) {
283
315
  const { label, value } = item;
@@ -290,16 +322,10 @@ class Select extends HTMLElement {
290
322
  );
291
323
  this._activeOption = selectOptionItem;
292
324
  } else {
293
- selectOptionItem.setAttribute(
294
- "class",
295
- "ranui-select-dropdown-option-item"
296
- );
325
+ selectOptionItem.setAttribute("class", "ranui-select-dropdown-option-item");
297
326
  }
298
327
  const selectOptionItemContent = document.createElement("div");
299
- selectOptionItemContent.setAttribute(
300
- "class",
301
- "ranui-select-dropdown-option-item-content"
302
- );
328
+ selectOptionItemContent.setAttribute("class", "ranui-select-dropdown-option-item-content");
303
329
  selectOptionItemContent.innerHTML = `${label}`;
304
330
  selectOptionItemContent.setAttribute("value", `${value}`);
305
331
  selectOptionItemContent.setAttribute("title", `${label}`);
@@ -311,11 +337,9 @@ class Select extends HTMLElement {
311
337
  });
312
338
  __publicField(this, "setDefaultValue", () => {
313
339
  const defaultValue = this.getAttribute("defaultValue") || this.getAttribute("value");
314
- if (!defaultValue)
315
- return;
340
+ if (!defaultValue) return;
316
341
  const label = this._optionValueMapLabel.get(defaultValue);
317
- if (!label)
318
- return;
342
+ if (!label) return;
319
343
  this.setAttribute("value", defaultValue);
320
344
  const rect = this.getBoundingClientRect();
321
345
  const { height } = rect;
@@ -348,34 +372,31 @@ class Select extends HTMLElement {
348
372
  });
349
373
  __publicField(this, "setShowSearch", () => {
350
374
  this.onSearch = searchThrottle(this.changeSearch);
351
- this._search.addEventListener("change", this.onSearch);
352
- this._search.addEventListener("click", this.onSearch);
375
+ this.onSearch && this._search.addEventListener("change", this.onSearch);
376
+ this.onSearch && this._search.addEventListener("click", this.onSearch);
353
377
  });
354
378
  __publicField(this, "removeShowSearch", () => {
355
- this._search.removeEventListener("change", this.onSearch);
356
- this._search.removeEventListener("click", this.onSearch);
357
- });
358
- __publicField(this, "listenSlotChange", () => {
359
- this._slot.addEventListener("slotchange", this.addOptionToSlot);
360
- });
361
- __publicField(this, "removeListenSlotChange", () => {
362
- this._slot.removeEventListener("slotchange", this.addOptionToSlot);
379
+ this.onSearch && this._search.removeEventListener("change", this.onSearch);
380
+ this.onSearch && this._search.removeEventListener("click", this.onSearch);
363
381
  });
364
382
  __publicField(this, "listenActionEvent", () => {
365
383
  this.removeEventListener("mouseenter", this.selectMouseDown);
366
384
  this.removeEventListener("mouseleave", this.selectBlur);
367
385
  this.removeEventListener("click", this.selectMouseDown);
368
386
  this.removeEventListener("blur", this.selectBlur);
369
- if (this.action.includes("hover") && !isMobile()) {
387
+ if (this.trigger.includes("hover") && !isMobile()) {
370
388
  this.addEventListener("mouseenter", this.selectMouseDown);
371
389
  this.addEventListener("mouseleave", this.selectBlur);
372
390
  }
373
- if (this.action.includes("click")) {
391
+ if (this.trigger.includes("click")) {
374
392
  this.addEventListener("click", this.selectMouseDown);
375
393
  this.addEventListener("blur", this.selectBlur);
376
394
  }
377
395
  });
378
- this._slot = document.createElement("slot");
396
+ __publicField(this, "clickRemoveSelect", (e) => {
397
+ e.stopPropagation();
398
+ this.setSelectDropdownDisplayNone();
399
+ });
379
400
  this._select = document.createElement("div");
380
401
  this._select.setAttribute("class", "ran-select");
381
402
  this._select.setAttribute("part", "select");
@@ -383,7 +404,7 @@ class Select extends HTMLElement {
383
404
  this._selection.setAttribute("class", "selection");
384
405
  this._selection.setAttribute("part", "selection");
385
406
  this._selector = document.createElement("div");
386
- this._search = document.createElement("r-input");
407
+ this._search = document.createElement("ra-input");
387
408
  this._search.setAttribute("class", "selection-search");
388
409
  this._search.setAttribute("part", "search");
389
410
  this._search.setAttribute("type", "search");
@@ -391,7 +412,7 @@ class Select extends HTMLElement {
391
412
  this._text = document.createElement("span");
392
413
  this._text.setAttribute("class", "selection-item");
393
414
  this._text.setAttribute("part", "selection-item");
394
- this._icon = document.createElement("r-icon");
415
+ this._icon = document.createElement("ra-icon");
395
416
  this._icon.setAttribute("class", "icon");
396
417
  this._icon.setAttribute("part", "icon");
397
418
  this._icon.setAttribute("name", "arrow-down");
@@ -401,18 +422,10 @@ class Select extends HTMLElement {
401
422
  this._selector.appendChild(this._search);
402
423
  this._selection.appendChild(this._icon);
403
424
  this._selection.appendChild(this._selector);
404
- this._slot.setAttribute("class", "slot");
405
425
  this._select.appendChild(this._selection);
406
- this._select.appendChild(this._slot);
407
426
  this._optionList = [];
408
427
  this._optionLabelMapValue = /* @__PURE__ */ new Map();
409
428
  this._optionValueMapLabel = /* @__PURE__ */ new Map();
410
- const shadowRoot = this.attachShadow({ mode: "closed" });
411
- const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
412
- F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
413
- shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
414
- this._shadowDom = shadowRoot;
415
- shadowRoot.appendChild(this._select);
416
429
  }
417
430
  static get observedAttributes() {
418
431
  return [
@@ -428,8 +441,8 @@ class Select extends HTMLElement {
428
441
  // 挂载的节点
429
442
  "dropdownclass",
430
443
  // 弹窗的类名
431
- "action"
432
- // 触发下拉框的行为, click 还是 hover ,hover 在 isMobile 移动端无效
444
+ "trigger"
445
+ // 触发下拉框的行为,click 还是 hover,hover 在 isMobile 移动端无效
433
446
  ];
434
447
  }
435
448
  get value() {
@@ -484,11 +497,11 @@ class Select extends HTMLElement {
484
497
  set dropdownclass(value) {
485
498
  this.setAttribute("dropdownclass", value || "");
486
499
  }
487
- get action() {
488
- return this.getAttribute("action") || "click";
500
+ get trigger() {
501
+ return this.getAttribute("trigger") || "click";
489
502
  }
490
- set action(value) {
491
- this.setAttribute("action", value || "");
503
+ set trigger(value) {
504
+ this.setAttribute("trigger", value || "");
492
505
  }
493
506
  get disabled() {
494
507
  return isDisabled(this);
@@ -502,25 +515,11 @@ class Select extends HTMLElement {
502
515
  this._selection.setAttribute("disabled", "");
503
516
  }
504
517
  }
505
- handlerExternalCss() {
506
- if (this.sheet) {
507
- try {
508
- const sheet = new CSSStyleSheet();
509
- sheet.insertRule(this.sheet);
510
- this._shadowDom.adoptedStyleSheets = [sheet];
511
- } catch (error) {
512
- console.error(
513
- `Failed to parse the rule in CSSStyleSheet: ${this.sheet}`
514
- );
515
- }
516
- }
517
- }
518
518
  connectedCallback() {
519
- this.handlerExternalCss();
520
519
  this.createOption();
521
520
  this.listenActionEvent();
522
- this.listenSlotChange();
523
521
  this.setShowSearch();
522
+ document.addEventListener("click", this.clickRemoveSelect);
524
523
  }
525
524
  disconnectCallback() {
526
525
  var _a;
@@ -530,7 +529,7 @@ class Select extends HTMLElement {
530
529
  this.removeEventListener("blur", this.selectBlur);
531
530
  this.removeSelectDropdown();
532
531
  (_a = this._selectDropdown) == null ? void 0 : _a.removeEventListener("click", this.clickOption);
533
- this.removeListenSlotChange();
532
+ document.removeEventListener("click", this.clickRemoveSelect);
534
533
  }
535
534
  attributeChangedCallback(name, oldValue, newValue) {
536
535
  if (name === "disabled" && this._select) {
@@ -542,17 +541,14 @@ class Select extends HTMLElement {
542
541
  this._selection.removeAttribute("disabled");
543
542
  }
544
543
  }
545
- if (name === "sheet" && this._shadowDom && oldValue !== newValue) {
546
- this.handlerExternalCss();
547
- }
548
544
  }
549
545
  }
550
546
  function Custom() {
551
- if (typeof document !== "undefined" && !customElements.get("r-select")) {
552
- customElements.define("r-select", Select);
547
+ if (typeof document !== "undefined" && !customElements.get("ra-select")) {
548
+ customElements.define("ra-select", Select);
553
549
  return Select;
554
550
  } else {
555
- return createCustomError("document is undefined or r-select is exist");
551
+ return createCustomError("document is undefined or ra-select is exist");
556
552
  }
557
553
  }
558
554
  const index = Custom();
@@ -562,7 +558,7 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
562
558
  default: index
563
559
  }, Symbol.toStringTag, { value: "Module" }));
564
560
  export {
565
- Select as S,
566
- index as a,
561
+ Select,
562
+ index as default,
567
563
  index$1 as i
568
564
  };
@@ -0,0 +1,8 @@
1
+ import { i } from "./index-DJZmDHz-.js";
2
+ import { i as i2 } from "./index-WfFw4LJT.js";
3
+ import { i as i3 } from "./selectShadowless.js";
4
+ export {
5
+ i as icon,
6
+ i2 as input,
7
+ i3 as select
8
+ };
@@ -0,0 +1,4 @@
1
+ import { a } from "./index-BZR0HaP2.js";
2
+ export {
3
+ a as default
4
+ };