ranui 0.1.10-alpha.2 → 0.1.10-alpha.4

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 (134) hide show
  1. package/dist/{utils-74Icp-PI.js → arrow-down-Beig7FXI.js} +139 -28
  2. package/dist/assets/image/failImage.d.ts +2 -0
  3. package/dist/build/config.d.ts +3 -0
  4. package/dist/build/config.es.d.ts +2 -0
  5. package/dist/build/config.sha.d.ts +2 -0
  6. package/dist/build/config.umd.d.ts +2 -0
  7. package/dist/button.js +3 -3
  8. package/dist/checkbox.js +3 -3
  9. package/dist/colorpicker.js +7 -9
  10. package/dist/{colz-CRDozfZA.js → colz-DJZvo_8B.js} +3 -8
  11. package/dist/components/button/index.d.ts +39 -0
  12. package/dist/components/checkbox/index.d.ts +27 -0
  13. package/dist/components/colorpicker/index.d.ts +120 -0
  14. package/dist/components/dropdown/index.d.ts +28 -0
  15. package/dist/components/form/index.d.ts +2 -0
  16. package/dist/components/icon/index.d.ts +2 -0
  17. package/dist/components/image/index.d.ts +2 -0
  18. package/dist/components/input/index.d.ts +209 -0
  19. package/dist/components/loading/index.d.ts +77 -0
  20. package/dist/components/math/index.d.ts +17 -0
  21. package/dist/components/message/index.d.ts +16 -0
  22. package/dist/components/modal/index.d.ts +2 -0
  23. package/dist/components/player/index.d.ts +238 -0
  24. package/dist/components/popover/content/index.d.ts +16 -0
  25. package/dist/components/popover/index.d.ts +59 -0
  26. package/dist/components/preview/colz.d.ts +72 -0
  27. package/dist/components/preview/constant.d.ts +5 -0
  28. package/dist/components/preview/docx.d.ts +8 -0
  29. package/dist/components/preview/excel/excel.d.ts +2 -0
  30. package/dist/components/preview/excel/index.d.ts +2 -0
  31. package/dist/components/preview/excel/media.d.ts +37 -0
  32. package/dist/components/preview/index.d.ts +3 -0
  33. package/dist/components/preview/pdf.d.ts +2 -0
  34. package/dist/components/preview/pptx/index.d.ts +19 -0
  35. package/dist/components/preview/pptx/process_pptx.d.ts +23 -0
  36. package/dist/components/preview/pptx/t_xml.d.ts +1 -0
  37. package/dist/components/preview/pptx/worker.d.ts +1 -0
  38. package/dist/components/preview/types.d.ts +10 -0
  39. package/dist/components/progress/index.d.ts +41 -0
  40. package/dist/components/radar/index.d.ts +2 -0
  41. package/dist/components/scratch/index.d.ts +23 -0
  42. package/dist/components/select/dropdown-item/index.d.ts +23 -0
  43. package/dist/components/select/index.d.ts +115 -0
  44. package/dist/components/select/option/index.d.ts +2 -0
  45. package/dist/components/skeleton/index.d.ts +2 -0
  46. package/dist/components/tab/index.d.ts +410 -0
  47. package/dist/components/tabpane/index.d.ts +354 -0
  48. package/dist/{docx-CChZ5Ycr.js → docx-CHkPTdGU.js} +1 -1
  49. package/dist/drop-4j4abxje.js +36 -0
  50. package/dist/icon.js +3 -3
  51. package/dist/iconShadowless.js +3 -3
  52. package/dist/image.js +1 -1
  53. package/dist/{index-BpOERe9M.js → index-BZR0HaP2.js} +1 -4
  54. package/dist/{index-B2yRe66F.js → index-BafnazTJ.js} +9 -17
  55. package/dist/{index-Dapt713u.js → index-Bl6-5Hp8.js} +2438 -4361
  56. package/dist/{index-ByBbFhvo.js → index-BqWbyjm2.js} +1165 -1831
  57. package/dist/{index-DqtzBqPN.js → index-C0Xh8vJ3.js} +12 -23
  58. package/dist/{index-DRi1ylHx.js → index-C1rSQlmc.js} +16 -23
  59. package/dist/{index-Cbp6LrE5.js → index-C4Sv0T51.js} +6 -12
  60. package/dist/index-CCxIoCAT.js +657 -0
  61. package/dist/{index-BHmWrPCW.js → index-CGEx9VOA.js} +866 -1662
  62. package/dist/{index-C-p_Wpit.js → index-CILRcFIV.js} +3 -6
  63. package/dist/index-COa4RzeW.js +105 -0
  64. package/dist/{index-B4bfIbdI.js → index-CWNtaUwu.js} +17 -25
  65. package/dist/{index-DytfjwBV.js → index-CjSKJE6S.js} +11 -15
  66. package/dist/{index-C6wPL-2Y.js → index-Ck9TOxFh.js} +22 -41
  67. package/dist/{index-BF8tJ6rR.js → index-CryFK9u4.js} +11 -21
  68. package/dist/{index-C1x9Popy.js → index-DAxs7Dd2.js} +5 -12
  69. package/dist/index-DBecKjmY.js +279 -0
  70. package/dist/{index-CSnBqUsQ.js → index-DC5EA657.js} +2 -6
  71. package/dist/index-DEcHDJ1m.js +306 -0
  72. package/dist/index-DL-1C2RQ.js +496 -0
  73. package/dist/index-DN-kAx-A.js +72 -0
  74. package/dist/{index-DRWOSfdF.js → index-DUF6lQQS.js} +15 -28
  75. package/dist/{index-Du-Biu-I.js → index-KS2nvVcO.js} +1 -4
  76. package/dist/{index-CFnsLnrb.js → index-WfFw4LJT.js} +42 -48
  77. package/dist/index.d.ts +231 -0
  78. package/dist/index.js +20 -26
  79. package/dist/input.js +2 -2
  80. package/dist/inputShadowless.js +2 -2
  81. package/dist/{jszip.min-DD9Dc6z4.js → jszip.min-Dhs3nUkD.js} +699 -1027
  82. package/dist/katex-es-B5r5vt3m.js +14628 -0
  83. package/dist/loading-scene-BMc2wqKm.js +4 -0
  84. package/dist/loading.js +4 -2
  85. package/dist/math.js +7 -0
  86. package/dist/message.js +3 -2
  87. package/dist/{pdf-DpNqCylD.js → pdf-Cx0VWKFo.js} +2 -5
  88. package/dist/player.js +4 -4
  89. package/dist/playwright.config.d.ts +9 -0
  90. package/dist/plugins/auto-import-file.d.ts +0 -0
  91. package/dist/plugins/load-style.d.ts +6 -0
  92. package/dist/plugins/load-svg.d.ts +9 -0
  93. package/dist/popover.js +4 -2
  94. package/dist/preview.js +4 -4
  95. package/dist/progress.js +3 -3
  96. package/dist/radar.js +3 -3
  97. package/dist/select.js +6 -6
  98. package/dist/selectShadowless.js +562 -8
  99. package/dist/shadowless/icon/index.d.ts +3 -0
  100. package/dist/shadowless/input/index.d.ts +210 -0
  101. package/dist/shadowless/select/index.d.ts +109 -0
  102. package/dist/shadowless/select/option/index.d.ts +2 -0
  103. package/dist/shadowless/shadowless/index.js +3 -9
  104. package/dist/shadowless.d.ts +3 -0
  105. package/dist/skeleton.js +1 -1
  106. package/dist/style.css +1 -1
  107. package/dist/tab.js +3 -3
  108. package/dist/tabpane.js +1 -1
  109. package/dist/tests/button.spec.d.ts +1 -0
  110. package/dist/tsconfig.json +3 -2
  111. package/dist/typings.d.ts +211 -0
  112. package/dist/umd/index.umd.cjs +9 -9
  113. package/dist/umd/shadowless/shadowless.umd.cjs +1 -1
  114. package/dist/umd/shadowless/style.css +1 -1
  115. package/dist/umd/style.css +1 -1
  116. package/dist/utils/color.d.ts +52 -0
  117. package/dist/utils/image.d.ts +32 -0
  118. package/dist/utils/index.d.ts +72 -0
  119. package/dist/utils/math.d.ts +26 -0
  120. package/dist/utils/tween.d.ts +21 -0
  121. package/dist/vite.config.d.ts +7 -0
  122. package/package.json +47 -38
  123. package/readme.md +7 -48
  124. package/typings.d.ts +113 -2
  125. package/dist/arrow-down-D4qr4m33.js +0 -30
  126. package/dist/content.js +0 -6
  127. package/dist/global-DOOKQmNv.js +0 -4
  128. package/dist/index-01Qfd9QI.js +0 -207
  129. package/dist/index-CWWI8SHO.js +0 -206
  130. package/dist/index-CbyMC6Yz.js +0 -59
  131. package/dist/index-Cr9AYoGT.js +0 -498
  132. package/dist/index-DLB8VOy7.js +0 -281
  133. package/dist/index-DsIUhdNt.js +0 -533
  134. package/dist/option.js +0 -92
@@ -1,498 +0,0 @@
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, i as isMobile, d as generateThrottle } from "./utils-74Icp-PI.js";
8
- import { H as HTMLElementSSR, i as isDisabled, c as createCustomError } from "./index-CSnBqUsQ.js";
9
- import "./option.js";
10
- import "./index-DqtzBqPN.js";
11
- import "./index-CFnsLnrb.js";
12
- const placementDirection = {
13
- bottom: {
14
- add: "ran-select-dropdown-down-in",
15
- remove: "ran-select-dropdown-down-out"
16
- },
17
- top: {
18
- add: "ran-select-dropdown-up-in",
19
- remove: "ran-select-dropdown-up-out"
20
- }
21
- };
22
- const searchThrottle = generateThrottle();
23
- class Select extends HTMLElementSSR() {
24
- constructor() {
25
- super();
26
- __publicField(this, "removeTimeId");
27
- __publicField(this, "_select");
28
- __publicField(this, "_selection");
29
- __publicField(this, "_search");
30
- __publicField(this, "_icon");
31
- __publicField(this, "_selectDropdown");
32
- __publicField(this, "_selectionDropdown");
33
- __publicField(this, "_selectDropDownInTimeId");
34
- __publicField(this, "_selectDropDownOutTimeId");
35
- __publicField(this, "_optionList");
36
- __publicField(this, "_optionLabelMapValue");
37
- __publicField(this, "_optionValueMapLabel");
38
- __publicField(this, "_activeOption");
39
- __publicField(this, "_text");
40
- __publicField(this, "_selector");
41
- __publicField(this, "onSearch");
42
- /**
43
- * @description: 移除 select dropdown
44
- * @return {*}
45
- */
46
- __publicField(this, "setSelectDropdownDisplayNone", () => {
47
- if (this._selectDropDownOutTimeId)
48
- return;
49
- if (this._selectionDropdown && this._selectionDropdown.style.display !== "none") {
50
- addClassToElement(this._selectionDropdown, placementDirection[this.placement].remove);
51
- this._selectDropDownOutTimeId = setTimeout(() => {
52
- var _a;
53
- (_a = this._selectionDropdown) == null ? void 0 : _a.style.setProperty("display", "none");
54
- this._selectionDropdown && removeClassToElement(this._selectionDropdown, placementDirection[this.placement].remove);
55
- clearTimeout(this._selectDropDownOutTimeId);
56
- this._selectDropDownOutTimeId = void 0;
57
- }, 300);
58
- }
59
- });
60
- /**
61
- * @description: 添加 select dropdown
62
- * @return {*}
63
- */
64
- __publicField(this, "setSelectDropdownDisplayBlock", () => {
65
- var _a;
66
- if (this._selectDropDownInTimeId)
67
- return;
68
- if (this._selectionDropdown && this._selectionDropdown.style.display !== "block") {
69
- addClassToElement(this._selectionDropdown, placementDirection[this.placement].add);
70
- (_a = this._selectionDropdown) == null ? void 0 : _a.style.setProperty("display", "block");
71
- this._selectDropDownInTimeId = setTimeout(() => {
72
- this._selectionDropdown && removeClassToElement(this._selectionDropdown, placementDirection[this.placement].add);
73
- clearTimeout(this._selectDropDownInTimeId);
74
- this._selectDropDownInTimeId = void 0;
75
- }, 200);
76
- }
77
- });
78
- __publicField(this, "placementPosition", () => {
79
- if (!this._selectionDropdown || !this._selectDropdown)
80
- return;
81
- const rect = this.getBoundingClientRect();
82
- const { top, left, bottom, width, height, x, y, right } = rect;
83
- const root = document.getElementById(this.getPopupContainerId);
84
- this._selectionDropdown.style.setProperty("--ran-x", `${top + window.scrollX}`);
85
- this._selectionDropdown.style.setProperty("--ran-y", `${left + window.scrollY}`);
86
- let selectTop = bottom + window.scrollY;
87
- let selectLeft = left + window.scrollX;
88
- this._selectionDropdown.style.setProperty("width", `${width}px`);
89
- if (this.placement === "top") {
90
- selectTop = top + window.scrollY - this._selectionDropdown.clientHeight;
91
- }
92
- if (this.getPopupContainerId && root) {
93
- if (this.placement === "top") {
94
- selectTop = top - root.getBoundingClientRect().top - this._selectionDropdown.clientHeight;
95
- } else {
96
- selectTop = root.getBoundingClientRect().height;
97
- }
98
- selectLeft = 0;
99
- }
100
- this._selectionDropdown.style.setProperty("inset", `${selectTop}px auto auto ${selectLeft}px`);
101
- });
102
- /**
103
- * @description: 设置下拉框
104
- * @return {*}
105
- */
106
- __publicField(this, "selectMouseDown", (e) => {
107
- e.stopPropagation();
108
- if (isDisabled(this))
109
- return;
110
- this.removeDropDownTimeId();
111
- this.setSelectDropdownDisplayNone();
112
- this.setSelectDropdownDisplayBlock();
113
- this.placementPosition();
114
- });
115
- __publicField(this, "removeDropDownTimeId", () => {
116
- this._search.setAttribute("value", "");
117
- if (this.trigger.includes("hover") && !isMobile()) {
118
- clearTimeout(this.removeTimeId);
119
- this.removeTimeId = void 0;
120
- }
121
- });
122
- /**
123
- * @description: 焦点移除的情况,需要移除select 下拉框
124
- * @return {*}
125
- */
126
- __publicField(this, "selectBlur", () => {
127
- if (this.removeTimeId) {
128
- this.removeDropDownTimeId();
129
- }
130
- this.removeTimeId = setTimeout(() => {
131
- this.removeDropDownTimeId();
132
- this.setSelectDropdownDisplayNone();
133
- }, 100);
134
- });
135
- /**
136
- * @description: 选中一个选项的情况
137
- * @param {MouseEvent} e
138
- * @return {*}
139
- */
140
- __publicField(this, "clickOption", (e) => {
141
- var _a, _b;
142
- e.stopPropagation();
143
- let element = e.target;
144
- if ((_a = element.classList) == null ? void 0 : _a.contains("ranui-select-dropdown-option-item")) {
145
- element = element.children[0];
146
- }
147
- if (!((_b = element.classList) == null ? void 0 : _b.contains("ranui-select-dropdown-option-item-content")))
148
- return;
149
- const label = element.innerHTML;
150
- const value = this._optionLabelMapValue.get(label);
151
- if (value) {
152
- this.setAttribute("value", value);
153
- this._text.innerHTML = label;
154
- this._text.setAttribute("title", label);
155
- this._search.setAttribute("placeholder", label);
156
- }
157
- const rect = this.getBoundingClientRect();
158
- const { height } = rect;
159
- this._text.style.setProperty("line-height", `${height}px`);
160
- if (this._activeOption) {
161
- removeClassToElement(this._activeOption, "ranui-select-dropdown-option-active");
162
- }
163
- setTimeout(() => {
164
- this._activeOption = (element == null ? void 0 : element.parentElement) || void 0;
165
- if (this._activeOption) {
166
- addClassToElement(this._activeOption, "ranui-select-dropdown-option-active");
167
- }
168
- }, 200);
169
- this.setSelectDropdownDisplayNone();
170
- this.dispatchEvent(new CustomEvent("change", { detail: { value, label } }));
171
- this.removeDropDownTimeId();
172
- });
173
- /**
174
- * @description: 初始化创建选项下拉框
175
- * @return {*}
176
- */
177
- __publicField(this, "createOption", () => {
178
- if (!this._selectDropdown) {
179
- this.appendChild(this._select);
180
- const container = document.getElementById(this.getPopupContainerId) || document.body;
181
- this._selectDropdown = document.createElement("div");
182
- this._selectDropdown.style.setProperty("-webkit-tap-highlight-color", "transparent");
183
- this._selectDropdown.style.setProperty("outline", "0");
184
- this._selectDropdown.addEventListener("click", this.clickOption);
185
- this._selectionDropdown = document.createElement("div");
186
- this._selectionDropdown.style.setProperty("-webkit-tap-highlight-color", "transparent");
187
- this._selectionDropdown.style.setProperty("outline", "0");
188
- if (this.dropdownclass) {
189
- this._selectionDropdown.setAttribute("class", `${this.dropdownclass} ranui-select-dropdown`);
190
- } else {
191
- this._selectionDropdown.setAttribute("class", "ranui-select-dropdown");
192
- }
193
- if (this.trigger.includes("hover") && !isMobile()) {
194
- this._selectDropdown.addEventListener("mouseleave", this.selectBlur);
195
- this._selectDropdown.addEventListener("mouseenter", this.removeDropDownTimeId);
196
- }
197
- this._selectDropdown.appendChild(this._selectionDropdown);
198
- this._selectionDropdown.style.setProperty("display", "none");
199
- container.appendChild(this._selectDropdown);
200
- }
201
- this.addOptionToSlot();
202
- });
203
- /**
204
- * @description: 移除选项下拉框
205
- * @return {*}
206
- */
207
- __publicField(this, "removeSelectDropdown", () => {
208
- try {
209
- if (this._selectDropdown) {
210
- const container = document.getElementById(this.getPopupContainerId) || document.body;
211
- container.removeChild(this._selectDropdown);
212
- }
213
- } catch (error) {
214
- }
215
- });
216
- /**
217
- * @description: 当select中有option元素的时候,给dropdown添加元素
218
- * @return {*}
219
- */
220
- __publicField(this, "addOptionToSlot", () => {
221
- var _a;
222
- const child = this.children || [];
223
- this._optionList = [];
224
- for (const item of child) {
225
- if (item.tagName === "R-OPTION") {
226
- const label = item.innerHTML;
227
- const value = item.getAttribute("value") || "";
228
- (_a = this._optionList) == null ? void 0 : _a.push({ label, value });
229
- this._optionLabelMapValue.set(label, value);
230
- this._optionValueMapLabel.set(value, label);
231
- }
232
- }
233
- this.createSelectDropdownContent(this._optionList);
234
- });
235
- __publicField(this, "createSelectDropdownContent", (options = []) => {
236
- var _a, _b;
237
- if (options.length === 0) {
238
- (_a = this._selectDropdown) == null ? void 0 : _a.style.setProperty("display", "none");
239
- } else {
240
- (_b = this._selectDropdown) == null ? void 0 : _b.style.setProperty("display", "block");
241
- }
242
- if (this._selectionDropdown) {
243
- this._selectionDropdown.innerHTML = "";
244
- }
245
- options.forEach((item) => {
246
- if (this._selectionDropdown) {
247
- const { label, value } = item;
248
- const selectOptionItem = document.createElement("div");
249
- const defaultValue = this.getAttribute("defaultValue") || this.getAttribute("value");
250
- if (defaultValue === value) {
251
- selectOptionItem.setAttribute(
252
- "class",
253
- "ranui-select-dropdown-option-active ranui-select-dropdown-option-item"
254
- );
255
- this._activeOption = selectOptionItem;
256
- } else {
257
- selectOptionItem.setAttribute("class", "ranui-select-dropdown-option-item");
258
- }
259
- const selectOptionItemContent = document.createElement("div");
260
- selectOptionItemContent.setAttribute("class", "ranui-select-dropdown-option-item-content");
261
- selectOptionItemContent.innerHTML = `${label}`;
262
- selectOptionItemContent.setAttribute("value", `${value}`);
263
- selectOptionItemContent.setAttribute("title", `${label}`);
264
- selectOptionItem.appendChild(selectOptionItemContent);
265
- this._selectionDropdown.appendChild(selectOptionItem);
266
- }
267
- });
268
- this.setDefaultValue();
269
- });
270
- __publicField(this, "setDefaultValue", () => {
271
- const defaultValue = this.getAttribute("defaultValue") || this.getAttribute("value");
272
- if (!defaultValue)
273
- return;
274
- const label = this._optionValueMapLabel.get(defaultValue);
275
- if (!label)
276
- return;
277
- this.setAttribute("value", defaultValue);
278
- const rect = this.getBoundingClientRect();
279
- const { height } = rect;
280
- this._text.style.setProperty("line-height", `${height}px`);
281
- this._text.innerHTML = label;
282
- this._text.setAttribute("title", label);
283
- });
284
- __publicField(this, "changeSearch", (e) => {
285
- const value = e.detail.value || "";
286
- this.dispatchEvent(
287
- new CustomEvent("search", {
288
- detail: { value }
289
- })
290
- );
291
- if (this._selectionDropdown) {
292
- this._selectionDropdown.innerHTML = "";
293
- }
294
- if (value.length > 0) {
295
- const options = this._optionList.map((item) => {
296
- const { label } = item;
297
- if (`${label}`.toLowerCase().includes(value)) {
298
- return { label, value: item.value };
299
- }
300
- return void 0;
301
- }).filter((item) => item);
302
- this.createSelectDropdownContent(options);
303
- } else {
304
- this.createSelectDropdownContent(this._optionList);
305
- }
306
- });
307
- __publicField(this, "setShowSearch", () => {
308
- this.onSearch = searchThrottle(this.changeSearch);
309
- this.onSearch && this._search.addEventListener("change", this.onSearch);
310
- this.onSearch && this._search.addEventListener("click", this.onSearch);
311
- });
312
- __publicField(this, "removeShowSearch", () => {
313
- this.onSearch && this._search.removeEventListener("change", this.onSearch);
314
- this.onSearch && this._search.removeEventListener("click", this.onSearch);
315
- });
316
- __publicField(this, "listenActionEvent", () => {
317
- this.removeEventListener("mouseenter", this.selectMouseDown);
318
- this.removeEventListener("mouseleave", this.selectBlur);
319
- this.removeEventListener("click", this.selectMouseDown);
320
- this.removeEventListener("blur", this.selectBlur);
321
- if (this.trigger.includes("hover") && !isMobile()) {
322
- this.addEventListener("mouseenter", this.selectMouseDown);
323
- this.addEventListener("mouseleave", this.selectBlur);
324
- }
325
- if (this.trigger.includes("click")) {
326
- this.addEventListener("click", this.selectMouseDown);
327
- this.addEventListener("blur", this.selectBlur);
328
- }
329
- });
330
- __publicField(this, "clickRemoveSelect", (e) => {
331
- e.stopPropagation();
332
- this.setSelectDropdownDisplayNone();
333
- });
334
- this._select = document.createElement("div");
335
- this._select.setAttribute("class", "ran-select");
336
- this._select.setAttribute("part", "select");
337
- this._selection = document.createElement("div");
338
- this._selection.setAttribute("class", "selection");
339
- this._selection.setAttribute("part", "selection");
340
- this._selector = document.createElement("div");
341
- this._search = document.createElement("ra-input");
342
- this._search.setAttribute("class", "selection-search");
343
- this._search.setAttribute("part", "search");
344
- this._search.setAttribute("type", "search");
345
- this._search.setAttribute("autocomplete", "off");
346
- this._text = document.createElement("span");
347
- this._text.setAttribute("class", "selection-item");
348
- this._text.setAttribute("part", "selection-item");
349
- this._icon = document.createElement("ra-icon");
350
- this._icon.setAttribute("class", "icon");
351
- this._icon.setAttribute("part", "icon");
352
- this._icon.setAttribute("name", "arrow-down");
353
- this._icon.setAttribute("color", "#d9d9d9");
354
- this._icon.setAttribute("size", "16");
355
- this._selector.appendChild(this._text);
356
- this._selector.appendChild(this._search);
357
- this._selection.appendChild(this._icon);
358
- this._selection.appendChild(this._selector);
359
- this._select.appendChild(this._selection);
360
- this._optionList = [];
361
- this._optionLabelMapValue = /* @__PURE__ */ new Map();
362
- this._optionValueMapLabel = /* @__PURE__ */ new Map();
363
- }
364
- static get observedAttributes() {
365
- return [
366
- "disabled",
367
- "sheet",
368
- "clear",
369
- "type",
370
- "defaultValue",
371
- "showSearch",
372
- "placement",
373
- // 弹窗的方向
374
- "getPopupContainerId",
375
- // 挂载的节点
376
- "dropdownclass",
377
- // 弹窗的类名
378
- "trigger"
379
- // 触发下拉框的行为, click 还是 hover ,hover 在 isMobile 移动端无效
380
- ];
381
- }
382
- get value() {
383
- return this.getAttribute("value") || "";
384
- }
385
- set value(value) {
386
- if (!isDisabled(this) && value) {
387
- this.setAttribute("value", value);
388
- } else {
389
- this.removeAttribute("value");
390
- }
391
- }
392
- get defaultValue() {
393
- return this.getAttribute("defaultValue") || "";
394
- }
395
- set defaultValue(value) {
396
- this.setAttribute("defaultValue", value || "");
397
- }
398
- get showSearch() {
399
- return this.getAttribute("showSearch") || "";
400
- }
401
- set showSearch(value) {
402
- this.setAttribute("showSearch", value || "");
403
- }
404
- get type() {
405
- return this.getAttribute("type") || "";
406
- }
407
- set type(value) {
408
- this.setAttribute("type", value || "");
409
- }
410
- get placement() {
411
- return this.getAttribute("placement") || "bottom";
412
- }
413
- set placement(value) {
414
- this.setAttribute("placement", value || "");
415
- }
416
- get sheet() {
417
- return this.getAttribute("sheet") || "";
418
- }
419
- set sheet(value) {
420
- this.setAttribute("sheet", value || "");
421
- }
422
- get getPopupContainerId() {
423
- return this.getAttribute("getPopupContainerId") || "";
424
- }
425
- set getPopupContainerId(value) {
426
- this.setAttribute("getPopupContainerId", value || "");
427
- }
428
- get dropdownclass() {
429
- return this.getAttribute("dropdownclass") || "";
430
- }
431
- set dropdownclass(value) {
432
- this.setAttribute("dropdownclass", value || "");
433
- }
434
- get trigger() {
435
- return this.getAttribute("trigger") || "click";
436
- }
437
- set trigger(value) {
438
- this.setAttribute("trigger", value || "");
439
- }
440
- get disabled() {
441
- return isDisabled(this);
442
- }
443
- set disabled(value) {
444
- if (!value || value === "false") {
445
- this.removeAttribute("disabled");
446
- this._selection.removeAttribute("disabled");
447
- } else {
448
- this.setAttribute("disabled", "");
449
- this._selection.setAttribute("disabled", "");
450
- }
451
- }
452
- connectedCallback() {
453
- this.createOption();
454
- this.listenActionEvent();
455
- this.setShowSearch();
456
- document.addEventListener("click", this.clickRemoveSelect);
457
- }
458
- disconnectCallback() {
459
- var _a;
460
- this.removeEventListener("mouseenter", this.selectMouseDown);
461
- this.removeEventListener("mouseleave", this.selectBlur);
462
- this.removeEventListener("click", this.selectMouseDown);
463
- this.removeEventListener("blur", this.selectBlur);
464
- this.removeSelectDropdown();
465
- (_a = this._selectDropdown) == null ? void 0 : _a.removeEventListener("click", this.clickOption);
466
- document.removeEventListener("click", this.clickRemoveSelect);
467
- }
468
- attributeChangedCallback(name, oldValue, newValue) {
469
- if (name === "disabled" && this._select) {
470
- if (!newValue || newValue === "false") {
471
- this._select.setAttribute("disabled", "");
472
- this._selection.setAttribute("disabled", "");
473
- } else {
474
- this._select.removeAttribute("disabled");
475
- this._selection.removeAttribute("disabled");
476
- }
477
- }
478
- }
479
- }
480
- function Custom() {
481
- if (typeof document !== "undefined" && !customElements.get("ra-select")) {
482
- customElements.define("ra-select", Select);
483
- return Select;
484
- } else {
485
- return createCustomError("document is undefined or ra-select is exist");
486
- }
487
- }
488
- const index = Custom();
489
- const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
490
- __proto__: null,
491
- Select,
492
- default: index
493
- }, Symbol.toStringTag, { value: "Module" }));
494
- export {
495
- Select as S,
496
- index as a,
497
- index$1 as i
498
- };