ranui 0.1.9 → 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.
- package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +12 -0
- package/dist/arrow-down-C9jBUUt3.js +30 -0
- package/dist/assets/image/failImage.d.ts +2 -0
- package/dist/button.js +7 -0
- package/dist/checkbox.js +7 -0
- package/dist/colorpicker.js +13 -0
- package/dist/{colz-746223ab.js → colz-CRDozfZA.js} +1 -5
- package/dist/components/button/index.d.ts +7 -3
- package/dist/components/checkbox/index.d.ts +27 -0
- package/dist/components/colorpicker/index.d.ts +122 -0
- package/dist/components/content/index.d.ts +15 -0
- package/dist/components/input/index.d.ts +65 -41
- package/dist/components/message/index.d.ts +2 -0
- package/dist/components/option/index.d.ts +2 -1
- package/dist/components/player/index.d.ts +31 -6
- package/dist/components/popover/index.d.ts +39 -0
- package/dist/components/preview/docx.d.ts +1 -1
- package/dist/components/preview/index.d.ts +2 -0
- package/dist/components/preview/pptx/process_pptx.d.ts +1 -1
- package/dist/components/progress/index.d.ts +11 -5
- package/dist/components/radar/index.d.ts +1 -1
- package/dist/components/scratch/index.d.ts +5 -1
- package/dist/components/select/index.d.ts +15 -7
- package/dist/content.js +6 -0
- package/dist/docx-ajDUtnbM.js +3665 -0
- package/dist/global-DOfcrQ2N.js +4 -0
- package/dist/icon.js +6 -0
- package/dist/iconShadowless.js +6 -0
- package/dist/image.js +4 -0
- package/dist/index-0fvHQjmN.js +298 -0
- package/dist/{index-1b73beee.js → index-BLepXisd.js} +55 -90
- package/dist/{index-e2e5d725.js → index-BOoNI-Al.js} +113 -305
- package/dist/{index-2d16a084.js → index-BPBRPxND.js} +8 -10
- package/dist/{index-e03d23e7.js → index-BpOERe9M.js} +1 -1
- package/dist/index-Bv6Z6rIe.js +498 -0
- package/dist/index-ByJ7zZdQ.js +65641 -0
- package/dist/{index-b7790662.js → index-C1x9Popy.js} +1 -1
- package/dist/index-CCNK5H8T.js +103 -0
- package/dist/{index-458debf7.js → index-CD09p_mF.js} +7 -31
- package/dist/{index-1048a998.js → index-CFnsLnrb.js} +68 -19
- package/dist/{index-4443363f.js → index-CJZp9lE4.js} +29 -50
- package/dist/{index-57492b9b.js → index-CSnBqUsQ.js} +48 -1
- package/dist/index-CWWI8SHO.js +206 -0
- package/dist/{index-7b8840f9.js → index-CZlEoE62.js} +220 -1010
- package/dist/index-CbyMC6Yz.js +59 -0
- package/dist/index-CiBVH-oH.js +258 -0
- package/dist/{index-3cf72afd.js → index-DUMmFdJ7.js} +9 -23
- package/dist/{index-01b17e26.js → index-Du-Biu-I.js} +1 -1
- package/dist/index-EnzWG8R0.js +521 -0
- package/dist/index-F2RO3OU4.js +501 -0
- package/dist/{index-7216d6b0.js → index-GavQwMDL.js} +11 -29
- package/dist/{index-0d5b9435.js → index-suip9eAw.js} +2 -2
- package/dist/index.d.ts +18 -14
- package/dist/index.js +23 -19
- package/dist/info-circle-fill-CFeVMdci.js +4 -0
- package/dist/input.js +6 -0
- package/dist/inputShadowless.js +6 -0
- package/dist/jszip.min-Ca6PjkYs.js +2674 -0
- package/dist/message.js +5 -0
- package/dist/modal.js +4 -0
- package/dist/{components/option/index.js → option.js} +3 -6
- package/dist/{pdf-bdb7818a.js → pdf-B2a6ll8f.js} +1 -1
- package/dist/player.js +8 -0
- package/dist/popover.js +6 -0
- package/dist/preview.js +7 -0
- package/dist/progress.js +7 -0
- package/dist/radar.js +6 -0
- package/dist/select.js +10 -0
- package/dist/selectShadowless.js +10 -0
- package/dist/{umd/components/image → shadowless/icon}/index.d.ts +1 -0
- package/dist/{umd/components → shadowless}/input/index.d.ts +33 -8
- package/dist/{umd/components → shadowless}/select/index.d.ts +16 -12
- package/dist/shadowless/shadowless/index.js +14 -0
- package/dist/shadowless.d.ts +3 -0
- package/dist/skeleton.js +4 -0
- package/dist/sprite-CH2zLtZy.js +141 -0
- package/dist/style.css +1 -1
- package/dist/tab.js +6 -0
- package/dist/tabpane.js +4 -0
- package/dist/tsconfig.json +29 -0
- package/dist/umd/index.umd.cjs +21 -32
- package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
- package/dist/umd/shadowless/style.css +1 -0
- package/dist/umd/style.css +1 -1
- package/dist/utils/color.d.ts +52 -0
- package/dist/utils/index.d.ts +9 -1
- package/dist/{index-7913ec46.js → utils-BMBEcoPj.js} +279 -162
- package/dist/vite.config.d.ts +1 -0
- package/package.json +61 -36
- package/readme.md +14 -14
- package/typings.d.ts +101 -0
- package/dist/components/button/index.js +0 -8
- package/dist/components/icon/index.js +0 -6
- package/dist/components/image/index.js +0 -4
- package/dist/components/input/index.js +0 -6
- package/dist/components/message/index.js +0 -4
- package/dist/components/modal/index.js +0 -4
- package/dist/components/player/index.js +0 -12
- package/dist/components/preview/index.js +0 -8
- package/dist/components/progress/index.js +0 -8
- package/dist/components/radar/index.js +0 -7
- package/dist/components/select/index.js +0 -11
- package/dist/components/skeleton/index.js +0 -4
- package/dist/components/tab/index.js +0 -7
- package/dist/components/tabpane/index.js +0 -4
- package/dist/docx-c5d02d8c.js +0 -21
- package/dist/index-73ce455b.js +0 -264
- package/dist/index-c14450a9.js +0 -662
- package/dist/info-circle-fill-90ec9aa9.js +0 -14
- package/dist/umd/build/config.d.ts +0 -3
- package/dist/umd/build/config.umd.d.ts +0 -2
- package/dist/umd/components/button/index.d.ts +0 -35
- package/dist/umd/components/form/index.d.ts +0 -2
- package/dist/umd/components/icon/index.d.ts +0 -2
- package/dist/umd/components/message/index.d.ts +0 -14
- package/dist/umd/components/modal/index.d.ts +0 -2
- package/dist/umd/components/option/index.d.ts +0 -2
- package/dist/umd/components/player/index.d.ts +0 -213
- package/dist/umd/components/preview/colz.d.ts +0 -72
- package/dist/umd/components/preview/docx.d.ts +0 -8
- package/dist/umd/components/preview/excel/excel.d.ts +0 -2
- package/dist/umd/components/preview/excel/index.d.ts +0 -1
- package/dist/umd/components/preview/excel/media.d.ts +0 -37
- package/dist/umd/components/preview/index.d.ts +0 -6
- package/dist/umd/components/preview/pdf.d.ts +0 -1
- package/dist/umd/components/preview/pptx/index.d.ts +0 -16
- package/dist/umd/components/preview/pptx/process_pptx.d.ts +0 -23
- package/dist/umd/components/preview/pptx/t_xml.d.ts +0 -1
- package/dist/umd/components/preview/pptx/worker.d.ts +0 -1
- package/dist/umd/components/progress/index.d.ts +0 -36
- package/dist/umd/components/radar/index.d.ts +0 -2
- package/dist/umd/components/scratch/index.d.ts +0 -19
- package/dist/umd/components/skeleton/index.d.ts +0 -2
- package/dist/umd/components/tab/index.d.ts +0 -408
- package/dist/umd/components/tabpane/index.d.ts +0 -352
- package/dist/umd/index.d.ts +0 -14
- package/dist/umd/playwright.config.d.ts +0 -9
- package/dist/umd/plugins/auto-import-file.d.ts +0 -0
- package/dist/umd/plugins/load-style.d.ts +0 -6
- package/dist/umd/plugins/load-svg.d.ts +0 -9
- package/dist/umd/tests/button.spec.d.ts +0 -1
- package/dist/umd/utils/image.d.ts +0 -32
- package/dist/umd/utils/index.d.ts +0 -64
- package/dist/umd/utils/math.d.ts +0 -26
- package/dist/umd/utils/tween.d.ts +0 -21
- package/dist/umd/vite.config.d.ts +0 -6
- package/dist/vendor-f71e6f68.js +0 -92126
- /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
- /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
- /package/dist/{umd/build/config.es.d.ts → build/config.sha.d.ts} +0 -0
- /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
- /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
- /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
- /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
- /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
- /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
- /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
- /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
- /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
- /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
- /package/dist/{loading-09ca52df.js → loading-Dcc5RApI.js} +0 -0
- /package/dist/{lock-1d2487c9.js → lock-Cr7BnmWN.js} +0 -0
- /package/dist/{message-b2bfdea7.js → message-D36_Zo2l.js} +0 -0
- /package/dist/{power-off-6ade5a91.js → power-off-lQRbiBak.js} +0 -0
- /package/dist/{preview-b291aea8.js → preview-CJbz9GjO.js} +0 -0
- /package/dist/{setting-1e5ccb6d.js → setting-DemlgzVC.js} +0 -0
- /package/dist/{team-ca6a12e1.js → team-tl4NJXPC.js} +0 -0
- /package/dist/{unlock-f56086fd.js → unlock-CeU74z9n.js} +0 -0
- /package/dist/{user-5c01e665.js → user-B-eVXwuk.js} +0 -0
- /package/dist/{warning-circle-035e025c.js → warning-circle-DDUgEDIv.js} +0 -0
- /package/dist/{warning-circle-fill-d17c37c9.js → warning-circle-fill-lODUKz0i.js} +0 -0
package/dist/image.js
ADDED
|
@@ -0,0 +1,298 @@
|
|
|
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 { _ as __variableDynamicImportRuntimeHelper, s as str2Xml } from "./arrow-down-C9jBUUt3.js";
|
|
8
|
+
import "./utils-BMBEcoPj.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}:host{display:inline-flex}:host([spin]){animation-name:rotate;animation-duration:1.4s;animation-timing-function:linear;animation-iteration-count:infinite}.ran-icon{display:flex;align-items:center;justify-content:center}@keyframes rotate{to{transform:rotate(360deg)}}";
|
|
10
|
+
const X_LINKS_NS = "http://www.w3.org/1999/xlink";
|
|
11
|
+
const X_LINK_HREF = "xlink:href";
|
|
12
|
+
function Custom() {
|
|
13
|
+
if (typeof window !== "undefined" && !customElements.get("r-icon")) {
|
|
14
|
+
class RIcon extends HTMLElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
__publicField(this, "_icon");
|
|
18
|
+
__publicField(this, "_div");
|
|
19
|
+
/**
|
|
20
|
+
* @description: 本地加载 icon
|
|
21
|
+
*/
|
|
22
|
+
__publicField(this, "loadLocal", () => {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
__variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../assets/icons/add-user.svg": () => import("./add-user-BN1JlY7e.js"), "../../assets/icons/arrow-down.svg": () => import("./arrow-down-C9jBUUt3.js").then((n) => n.a), "../../assets/icons/book.svg": () => import("./book-nTEFXU2x.js"), "../../assets/icons/check-circle-fill.svg": () => import("./check-circle-fill-B_pd8ZSs.js"), "../../assets/icons/check-circle.svg": () => import("./check-circle-szyAJiap.js"), "../../assets/icons/close-circle-fill.svg": () => import("./close-circle-fill-jSqPPw9i.js"), "../../assets/icons/close-circle.svg": () => import("./close-circle-CwmuN2C6.js"), "../../assets/icons/close.svg": () => import("./close-CFnkhudp.js"), "../../assets/icons/eye-close.svg": () => import("./eye-close-BVr3NJtg.js"), "../../assets/icons/eye.svg": () => import("./eye-D_mEt17f.js"), "../../assets/icons/home.svg": () => import("./home-BUQ4USMk.js"), "../../assets/icons/info-circle-fill.svg": () => import("./info-circle-fill-CFeVMdci.js"), "../../assets/icons/info-circle.svg": () => import("./info-circle-COnL5bTJ.js"), "../../assets/icons/loading.svg": () => import("./loading-Dcc5RApI.js"), "../../assets/icons/lock.svg": () => import("./lock-Cr7BnmWN.js"), "../../assets/icons/message.svg": () => import("./message-D36_Zo2l.js"), "../../assets/icons/power-off.svg": () => import("./power-off-lQRbiBak.js"), "../../assets/icons/preview.svg": () => import("./preview-CJbz9GjO.js"), "../../assets/icons/setting.svg": () => import("./setting-DemlgzVC.js"), "../../assets/icons/sprite.svg": () => import("./sprite-CH2zLtZy.js"), "../../assets/icons/team.svg": () => import("./team-tl4NJXPC.js"), "../../assets/icons/unlock.svg": () => import("./unlock-CeU74z9n.js"), "../../assets/icons/user.svg": () => import("./user-B-eVXwuk.js"), "../../assets/icons/warning-circle-fill.svg": () => import("./warning-circle-fill-lODUKz0i.js"), "../../assets/icons/warning-circle.svg": () => import("./warning-circle-DDUgEDIv.js") }), `../../assets/icons/${this.name}.svg`).then((result) => {
|
|
25
|
+
if (result && result.default && result.default._identification) {
|
|
26
|
+
const { data } = result.default;
|
|
27
|
+
this._icon && this._div.removeChild(this._icon);
|
|
28
|
+
this._icon = str2Xml(data, "image/svg+xml");
|
|
29
|
+
if (this._icon) {
|
|
30
|
+
this._div.appendChild(this._icon);
|
|
31
|
+
this.setSize();
|
|
32
|
+
this.setColor();
|
|
33
|
+
resolve();
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
this.loadNs();
|
|
37
|
+
reject(`
|
|
38
|
+
couldn't be loaded by r-icon, message: ${this.name} icon is undefined`);
|
|
39
|
+
}
|
|
40
|
+
}).catch((error) => {
|
|
41
|
+
this.loadNs();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* @description: NS 加载 icon
|
|
47
|
+
*/
|
|
48
|
+
__publicField(this, "loadNs", () => {
|
|
49
|
+
if (this._icon && this._div) {
|
|
50
|
+
this._div.removeChild(this._icon);
|
|
51
|
+
}
|
|
52
|
+
this._icon = document.createElement("svg");
|
|
53
|
+
this._icon.setAttribute("class", "icon");
|
|
54
|
+
this._icon.setAttribute("viewBox", "0 0 1024 1024");
|
|
55
|
+
this._icon.setAttribute("width", "100");
|
|
56
|
+
this._icon.setAttribute("height", "100");
|
|
57
|
+
const use = document.createElementNS(X_LINKS_NS, "use");
|
|
58
|
+
use.setAttributeNS(X_LINKS_NS, X_LINK_HREF, `../../assets/iconfont/icon.svg#icon-${this.name}`);
|
|
59
|
+
this._icon.appendChild(use);
|
|
60
|
+
this._div.appendChild(this._icon);
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* @description: 根据 name 属性加载对应的 svg
|
|
64
|
+
*/
|
|
65
|
+
__publicField(this, "setIcon", async () => {
|
|
66
|
+
if (this.name) {
|
|
67
|
+
this.loadLocal();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* @description: 设置 icon 的大小
|
|
72
|
+
*/
|
|
73
|
+
__publicField(this, "setSize", () => {
|
|
74
|
+
if (this._icon && this.size) {
|
|
75
|
+
this._icon.setAttribute("width", this.size);
|
|
76
|
+
this._icon.setAttribute("height", this.size);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* @description: 设置 icon 的颜色
|
|
81
|
+
*/
|
|
82
|
+
__publicField(this, "setColor", () => {
|
|
83
|
+
if (this._icon) {
|
|
84
|
+
this.color ? this._icon.setAttribute("fill", this.color) : this._icon.setAttribute("fill", "currentColor");
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* @description: 设置是否旋转和旋转的速度
|
|
89
|
+
*/
|
|
90
|
+
__publicField(this, "setSpin", () => {
|
|
91
|
+
if (this.spin) {
|
|
92
|
+
this.style.setProperty("animation-duration", `${this.spin}s`);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
this._div = document.createElement("div");
|
|
96
|
+
this._div.setAttribute("class", "ran-icon");
|
|
97
|
+
this._div.setAttribute("part", "ran-icon");
|
|
98
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
99
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
100
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
101
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
102
|
+
shadowRoot.appendChild(this._div);
|
|
103
|
+
}
|
|
104
|
+
static get observedAttributes() {
|
|
105
|
+
return ["name", "size", "color", "spin"];
|
|
106
|
+
}
|
|
107
|
+
get name() {
|
|
108
|
+
return this.getAttribute("name");
|
|
109
|
+
}
|
|
110
|
+
set name(value) {
|
|
111
|
+
if (value)
|
|
112
|
+
this.setAttribute("name", value);
|
|
113
|
+
}
|
|
114
|
+
get size() {
|
|
115
|
+
return this.getAttribute("size");
|
|
116
|
+
}
|
|
117
|
+
set size(value) {
|
|
118
|
+
if (value)
|
|
119
|
+
this.setAttribute("size", value);
|
|
120
|
+
}
|
|
121
|
+
get color() {
|
|
122
|
+
return this.getAttribute("color");
|
|
123
|
+
}
|
|
124
|
+
set color(value) {
|
|
125
|
+
if (value)
|
|
126
|
+
this.setAttribute("color", value);
|
|
127
|
+
}
|
|
128
|
+
get spin() {
|
|
129
|
+
return this.getAttribute("spin");
|
|
130
|
+
}
|
|
131
|
+
set spin(value) {
|
|
132
|
+
if (value != null)
|
|
133
|
+
this.setAttribute("spin", value);
|
|
134
|
+
}
|
|
135
|
+
connectedCallback() {
|
|
136
|
+
this.setIcon();
|
|
137
|
+
}
|
|
138
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
139
|
+
if (newValue !== oldValue) {
|
|
140
|
+
if (name === "name")
|
|
141
|
+
this.setIcon();
|
|
142
|
+
if (name === "size")
|
|
143
|
+
this.setSize();
|
|
144
|
+
if (name === "color")
|
|
145
|
+
this.setColor();
|
|
146
|
+
if (name === "spin")
|
|
147
|
+
this.setSpin();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
customElements.define("r-icon", RIcon);
|
|
152
|
+
}
|
|
153
|
+
if (typeof window !== "undefined" && !customElements.get("ra-icon")) {
|
|
154
|
+
class RaIcon extends HTMLElement {
|
|
155
|
+
constructor() {
|
|
156
|
+
super();
|
|
157
|
+
__publicField(this, "_icon");
|
|
158
|
+
__publicField(this, "_div");
|
|
159
|
+
/**
|
|
160
|
+
* @description: 本地加载 icon
|
|
161
|
+
*/
|
|
162
|
+
__publicField(this, "loadLocal", () => {
|
|
163
|
+
return new Promise((resolve, reject) => {
|
|
164
|
+
__variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../assets/icons/add-user.svg": () => import("./add-user-BN1JlY7e.js"), "../../assets/icons/arrow-down.svg": () => import("./arrow-down-C9jBUUt3.js").then((n) => n.a), "../../assets/icons/book.svg": () => import("./book-nTEFXU2x.js"), "../../assets/icons/check-circle-fill.svg": () => import("./check-circle-fill-B_pd8ZSs.js"), "../../assets/icons/check-circle.svg": () => import("./check-circle-szyAJiap.js"), "../../assets/icons/close-circle-fill.svg": () => import("./close-circle-fill-jSqPPw9i.js"), "../../assets/icons/close-circle.svg": () => import("./close-circle-CwmuN2C6.js"), "../../assets/icons/close.svg": () => import("./close-CFnkhudp.js"), "../../assets/icons/eye-close.svg": () => import("./eye-close-BVr3NJtg.js"), "../../assets/icons/eye.svg": () => import("./eye-D_mEt17f.js"), "../../assets/icons/home.svg": () => import("./home-BUQ4USMk.js"), "../../assets/icons/info-circle-fill.svg": () => import("./info-circle-fill-CFeVMdci.js"), "../../assets/icons/info-circle.svg": () => import("./info-circle-COnL5bTJ.js"), "../../assets/icons/loading.svg": () => import("./loading-Dcc5RApI.js"), "../../assets/icons/lock.svg": () => import("./lock-Cr7BnmWN.js"), "../../assets/icons/message.svg": () => import("./message-D36_Zo2l.js"), "../../assets/icons/power-off.svg": () => import("./power-off-lQRbiBak.js"), "../../assets/icons/preview.svg": () => import("./preview-CJbz9GjO.js"), "../../assets/icons/setting.svg": () => import("./setting-DemlgzVC.js"), "../../assets/icons/sprite.svg": () => import("./sprite-CH2zLtZy.js"), "../../assets/icons/team.svg": () => import("./team-tl4NJXPC.js"), "../../assets/icons/unlock.svg": () => import("./unlock-CeU74z9n.js"), "../../assets/icons/user.svg": () => import("./user-B-eVXwuk.js"), "../../assets/icons/warning-circle-fill.svg": () => import("./warning-circle-fill-lODUKz0i.js"), "../../assets/icons/warning-circle.svg": () => import("./warning-circle-DDUgEDIv.js") }), `../../assets/icons/${this.name}.svg`).then((result) => {
|
|
165
|
+
if (result && result.default && result.default._identification) {
|
|
166
|
+
const { data } = result.default;
|
|
167
|
+
this._icon && this._div.removeChild(this._icon);
|
|
168
|
+
this._icon = str2Xml(data, "image/svg+xml");
|
|
169
|
+
if (this._icon) {
|
|
170
|
+
this._div.appendChild(this._icon);
|
|
171
|
+
this.setSize();
|
|
172
|
+
this.setColor();
|
|
173
|
+
resolve();
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
this.loadNs();
|
|
177
|
+
reject(`
|
|
178
|
+
couldn't be loaded by r-icon, message: ${this.name} icon is undefined`);
|
|
179
|
+
}
|
|
180
|
+
}).catch((error) => {
|
|
181
|
+
this.loadNs();
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* @description: NS 加载 icon
|
|
187
|
+
*/
|
|
188
|
+
__publicField(this, "loadNs", () => {
|
|
189
|
+
if (this._icon && this._div) {
|
|
190
|
+
this._div.removeChild(this._icon);
|
|
191
|
+
}
|
|
192
|
+
this._icon = document.createElement("svg");
|
|
193
|
+
this._icon.setAttribute("class", "icon");
|
|
194
|
+
this._icon.setAttribute("viewBox", "0 0 1024 1024");
|
|
195
|
+
this._icon.setAttribute("width", "100");
|
|
196
|
+
this._icon.setAttribute("height", "100");
|
|
197
|
+
const use = document.createElementNS(X_LINKS_NS, "use");
|
|
198
|
+
use.setAttributeNS(X_LINKS_NS, X_LINK_HREF, `../../assets/iconfont/icon.svg#icon-${this.name}`);
|
|
199
|
+
this._icon.appendChild(use);
|
|
200
|
+
this._div.appendChild(this._icon);
|
|
201
|
+
});
|
|
202
|
+
/**
|
|
203
|
+
* @description: 根据 name 属性加载对应的 svg
|
|
204
|
+
*/
|
|
205
|
+
__publicField(this, "setIcon", async () => {
|
|
206
|
+
if (this.name) {
|
|
207
|
+
this.loadLocal();
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
/**
|
|
211
|
+
* @description: 设置 icon 的大小
|
|
212
|
+
*/
|
|
213
|
+
__publicField(this, "setSize", () => {
|
|
214
|
+
if (this._icon && this.size) {
|
|
215
|
+
this._icon.setAttribute("width", this.size);
|
|
216
|
+
this._icon.setAttribute("height", this.size);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* @description: 设置 icon 的颜色
|
|
221
|
+
*/
|
|
222
|
+
__publicField(this, "setColor", () => {
|
|
223
|
+
if (this._icon) {
|
|
224
|
+
this.color ? this._icon.setAttribute("fill", this.color) : this._icon.setAttribute("fill", "currentColor");
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
/**
|
|
228
|
+
* @description: 设置是否旋转和旋转的速度
|
|
229
|
+
*/
|
|
230
|
+
__publicField(this, "setSpin", () => {
|
|
231
|
+
if (this.spin) {
|
|
232
|
+
this.style.setProperty("animation-duration", `${this.spin}s`);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
this._div = document.createElement("div");
|
|
236
|
+
this._div.setAttribute("class", "ran-icon");
|
|
237
|
+
this._div.setAttribute("part", "ran-icon");
|
|
238
|
+
}
|
|
239
|
+
static get observedAttributes() {
|
|
240
|
+
return ["name", "size", "color", "spin"];
|
|
241
|
+
}
|
|
242
|
+
get name() {
|
|
243
|
+
return this.getAttribute("name");
|
|
244
|
+
}
|
|
245
|
+
set name(value) {
|
|
246
|
+
if (value)
|
|
247
|
+
this.setAttribute("name", value);
|
|
248
|
+
}
|
|
249
|
+
get size() {
|
|
250
|
+
return this.getAttribute("size");
|
|
251
|
+
}
|
|
252
|
+
set size(value) {
|
|
253
|
+
if (value)
|
|
254
|
+
this.setAttribute("size", value);
|
|
255
|
+
}
|
|
256
|
+
get color() {
|
|
257
|
+
return this.getAttribute("color");
|
|
258
|
+
}
|
|
259
|
+
set color(value) {
|
|
260
|
+
if (value)
|
|
261
|
+
this.setAttribute("color", value);
|
|
262
|
+
}
|
|
263
|
+
get spin() {
|
|
264
|
+
return this.getAttribute("spin");
|
|
265
|
+
}
|
|
266
|
+
set spin(value) {
|
|
267
|
+
if (value != null)
|
|
268
|
+
this.setAttribute("spin", value);
|
|
269
|
+
}
|
|
270
|
+
connectedCallback() {
|
|
271
|
+
this.appendChild(this._div);
|
|
272
|
+
this.setIcon();
|
|
273
|
+
}
|
|
274
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
275
|
+
if (newValue !== oldValue) {
|
|
276
|
+
if (name === "name")
|
|
277
|
+
this.setIcon();
|
|
278
|
+
if (name === "size")
|
|
279
|
+
this.setSize();
|
|
280
|
+
if (name === "color")
|
|
281
|
+
this.setColor();
|
|
282
|
+
if (name === "spin")
|
|
283
|
+
this.setSpin();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
customElements.define("ra-icon", RaIcon);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const index = Custom();
|
|
291
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
292
|
+
__proto__: null,
|
|
293
|
+
default: index
|
|
294
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
295
|
+
export {
|
|
296
|
+
index as a,
|
|
297
|
+
index$1 as i
|
|
298
|
+
};
|
|
@@ -4,12 +4,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { a as addClassToElement, r as removeClassToElement, i as isMobile,
|
|
8
|
-
import { i as isDisabled, c as createCustomError } from "./index-
|
|
9
|
-
import "./
|
|
10
|
-
import "./index-
|
|
11
|
-
import "./index-
|
|
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}
|
|
7
|
+
import { a as addClassToElement, r as removeClassToElement, i as isMobile, d as generateThrottle } from "./utils-BMBEcoPj.js";
|
|
8
|
+
import { H as HTMLElementSSR, i as isDisabled, c as createCustomError } from "./index-CSnBqUsQ.js";
|
|
9
|
+
import "./option.js";
|
|
10
|
+
import "./index-0fvHQjmN.js";
|
|
11
|
+
import "./index-F2RO3OU4.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}r-select{position:relative;width:120px;height:40px}: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}';
|
|
13
13
|
const placementDirection = {
|
|
14
14
|
bottom: {
|
|
15
15
|
add: "ran-select-dropdown-down-in",
|
|
@@ -21,7 +21,7 @@ const placementDirection = {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
const searchThrottle = generateThrottle();
|
|
24
|
-
class Select extends
|
|
24
|
+
class Select extends HTMLElementSSR() {
|
|
25
25
|
constructor() {
|
|
26
26
|
super();
|
|
27
27
|
__publicField(this, "removeTimeId");
|
|
@@ -50,17 +50,11 @@ class Select extends HTMLElement {
|
|
|
50
50
|
if (this._selectDropDownOutTimeId)
|
|
51
51
|
return;
|
|
52
52
|
if (this._selectionDropdown && this._selectionDropdown.style.display !== "none") {
|
|
53
|
-
addClassToElement(
|
|
54
|
-
this._selectionDropdown,
|
|
55
|
-
placementDirection[this.placement].remove
|
|
56
|
-
);
|
|
53
|
+
addClassToElement(this._selectionDropdown, placementDirection[this.placement].remove);
|
|
57
54
|
this._selectDropDownOutTimeId = setTimeout(() => {
|
|
58
55
|
var _a;
|
|
59
56
|
(_a = this._selectionDropdown) == null ? void 0 : _a.style.setProperty("display", "none");
|
|
60
|
-
this._selectionDropdown && removeClassToElement(
|
|
61
|
-
this._selectionDropdown,
|
|
62
|
-
placementDirection[this.placement].remove
|
|
63
|
-
);
|
|
57
|
+
this._selectionDropdown && removeClassToElement(this._selectionDropdown, placementDirection[this.placement].remove);
|
|
64
58
|
clearTimeout(this._selectDropDownOutTimeId);
|
|
65
59
|
this._selectDropDownOutTimeId = void 0;
|
|
66
60
|
}, 300);
|
|
@@ -75,16 +69,10 @@ class Select extends HTMLElement {
|
|
|
75
69
|
if (this._selectDropDownInTimeId)
|
|
76
70
|
return;
|
|
77
71
|
if (this._selectionDropdown && this._selectionDropdown.style.display !== "block") {
|
|
78
|
-
addClassToElement(
|
|
79
|
-
this._selectionDropdown,
|
|
80
|
-
placementDirection[this.placement].add
|
|
81
|
-
);
|
|
72
|
+
addClassToElement(this._selectionDropdown, placementDirection[this.placement].add);
|
|
82
73
|
(_a = this._selectionDropdown) == null ? void 0 : _a.style.setProperty("display", "block");
|
|
83
74
|
this._selectDropDownInTimeId = setTimeout(() => {
|
|
84
|
-
this._selectionDropdown && removeClassToElement(
|
|
85
|
-
this._selectionDropdown,
|
|
86
|
-
placementDirection[this.placement].add
|
|
87
|
-
);
|
|
75
|
+
this._selectionDropdown && removeClassToElement(this._selectionDropdown, placementDirection[this.placement].add);
|
|
88
76
|
clearTimeout(this._selectDropDownInTimeId);
|
|
89
77
|
this._selectDropDownInTimeId = void 0;
|
|
90
78
|
}, 200);
|
|
@@ -95,35 +83,31 @@ class Select extends HTMLElement {
|
|
|
95
83
|
return;
|
|
96
84
|
const rect = this.getBoundingClientRect();
|
|
97
85
|
const { top, left, bottom, width, height, x, y, right } = rect;
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
);
|
|
102
|
-
this._selectionDropdown.style.setProperty(
|
|
103
|
-
"-ran-y",
|
|
104
|
-
`${y + window.scrollY}`
|
|
105
|
-
);
|
|
86
|
+
const root = document.getElementById(this.getPopupContainerId);
|
|
87
|
+
this._selectionDropdown.style.setProperty("--ran-x", `${top + window.scrollX}`);
|
|
88
|
+
this._selectionDropdown.style.setProperty("--ran-y", `${left + window.scrollY}`);
|
|
106
89
|
let selectTop = bottom + window.scrollY;
|
|
107
90
|
let selectLeft = left + window.scrollX;
|
|
108
91
|
this._selectionDropdown.style.setProperty("width", `${width}px`);
|
|
109
|
-
const root = document.getElementById(this.getPopupContainerId);
|
|
110
92
|
if (this.placement === "top") {
|
|
111
93
|
selectTop = top + window.scrollY - this._selectionDropdown.clientHeight;
|
|
112
|
-
|
|
94
|
+
}
|
|
95
|
+
if (this.getPopupContainerId && root) {
|
|
96
|
+
if (this.placement === "top") {
|
|
113
97
|
selectTop = top - root.getBoundingClientRect().top - this._selectionDropdown.clientHeight;
|
|
114
|
-
|
|
98
|
+
} else {
|
|
99
|
+
selectTop = root.getBoundingClientRect().height;
|
|
115
100
|
}
|
|
101
|
+
selectLeft = 0;
|
|
116
102
|
}
|
|
117
|
-
this._selectionDropdown.style.setProperty(
|
|
118
|
-
"inset",
|
|
119
|
-
`${selectTop}px auto auto ${selectLeft}px`
|
|
120
|
-
);
|
|
103
|
+
this._selectionDropdown.style.setProperty("inset", `${selectTop}px auto auto ${selectLeft}px`);
|
|
121
104
|
});
|
|
122
105
|
/**
|
|
123
106
|
* @description: 设置下拉框
|
|
124
107
|
* @return {*}
|
|
125
108
|
*/
|
|
126
|
-
__publicField(this, "selectMouseDown", () => {
|
|
109
|
+
__publicField(this, "selectMouseDown", (e) => {
|
|
110
|
+
e.stopPropagation();
|
|
127
111
|
if (isDisabled(this))
|
|
128
112
|
return;
|
|
129
113
|
this.removeDropDownTimeId();
|
|
@@ -133,7 +117,7 @@ class Select extends HTMLElement {
|
|
|
133
117
|
});
|
|
134
118
|
__publicField(this, "removeDropDownTimeId", () => {
|
|
135
119
|
this._search.setAttribute("value", "");
|
|
136
|
-
if (this.
|
|
120
|
+
if (this.trigger.includes("hover") && !isMobile()) {
|
|
137
121
|
clearTimeout(this.removeTimeId);
|
|
138
122
|
this.removeTimeId = void 0;
|
|
139
123
|
}
|
|
@@ -149,7 +133,7 @@ class Select extends HTMLElement {
|
|
|
149
133
|
this.removeTimeId = setTimeout(() => {
|
|
150
134
|
this.removeDropDownTimeId();
|
|
151
135
|
this.setSelectDropdownDisplayNone();
|
|
152
|
-
},
|
|
136
|
+
}, 100);
|
|
153
137
|
});
|
|
154
138
|
/**
|
|
155
139
|
* @description: 选中一个选项的情况
|
|
@@ -158,6 +142,7 @@ class Select extends HTMLElement {
|
|
|
158
142
|
*/
|
|
159
143
|
__publicField(this, "clickOption", (e) => {
|
|
160
144
|
var _a, _b;
|
|
145
|
+
e.stopPropagation();
|
|
161
146
|
let element = e.target;
|
|
162
147
|
if ((_a = element.classList) == null ? void 0 : _a.contains("ranui-select-dropdown-option-item")) {
|
|
163
148
|
element = element.children[0];
|
|
@@ -176,18 +161,12 @@ class Select extends HTMLElement {
|
|
|
176
161
|
const { height } = rect;
|
|
177
162
|
this._text.style.setProperty("line-height", `${height}px`);
|
|
178
163
|
if (this._activeOption) {
|
|
179
|
-
removeClassToElement(
|
|
180
|
-
this._activeOption,
|
|
181
|
-
"ranui-select-dropdown-option-active"
|
|
182
|
-
);
|
|
164
|
+
removeClassToElement(this._activeOption, "ranui-select-dropdown-option-active");
|
|
183
165
|
}
|
|
184
166
|
setTimeout(() => {
|
|
185
167
|
this._activeOption = (element == null ? void 0 : element.parentElement) || void 0;
|
|
186
168
|
if (this._activeOption) {
|
|
187
|
-
addClassToElement(
|
|
188
|
-
this._activeOption,
|
|
189
|
-
"ranui-select-dropdown-option-active"
|
|
190
|
-
);
|
|
169
|
+
addClassToElement(this._activeOption, "ranui-select-dropdown-option-active");
|
|
191
170
|
}
|
|
192
171
|
}, 200);
|
|
193
172
|
this.setSelectDropdownDisplayNone();
|
|
@@ -202,32 +181,20 @@ class Select extends HTMLElement {
|
|
|
202
181
|
if (!this._selectDropdown) {
|
|
203
182
|
const container = document.getElementById(this.getPopupContainerId) || document.body;
|
|
204
183
|
this._selectDropdown = document.createElement("div");
|
|
205
|
-
this._selectDropdown.style.setProperty(
|
|
206
|
-
"-webkit-tap-highlight-color",
|
|
207
|
-
"transparent"
|
|
208
|
-
);
|
|
184
|
+
this._selectDropdown.style.setProperty("-webkit-tap-highlight-color", "transparent");
|
|
209
185
|
this._selectDropdown.style.setProperty("outline", "0");
|
|
210
186
|
this._selectDropdown.addEventListener("click", this.clickOption);
|
|
211
187
|
this._selectionDropdown = document.createElement("div");
|
|
212
|
-
this._selectionDropdown.style.setProperty(
|
|
213
|
-
"-webkit-tap-highlight-color",
|
|
214
|
-
"transparent"
|
|
215
|
-
);
|
|
188
|
+
this._selectionDropdown.style.setProperty("-webkit-tap-highlight-color", "transparent");
|
|
216
189
|
this._selectionDropdown.style.setProperty("outline", "0");
|
|
217
190
|
if (this.dropdownclass) {
|
|
218
|
-
this._selectionDropdown.setAttribute(
|
|
219
|
-
"class",
|
|
220
|
-
`${this.dropdownclass} ranui-select-dropdown`
|
|
221
|
-
);
|
|
191
|
+
this._selectionDropdown.setAttribute("class", `${this.dropdownclass} ranui-select-dropdown`);
|
|
222
192
|
} else {
|
|
223
193
|
this._selectionDropdown.setAttribute("class", "ranui-select-dropdown");
|
|
224
194
|
}
|
|
225
|
-
if (this.
|
|
195
|
+
if (this.trigger.includes("hover") && !isMobile()) {
|
|
226
196
|
this._selectDropdown.addEventListener("mouseleave", this.selectBlur);
|
|
227
|
-
this._selectDropdown.addEventListener(
|
|
228
|
-
"mouseenter",
|
|
229
|
-
this.removeDropDownTimeId
|
|
230
|
-
);
|
|
197
|
+
this._selectDropdown.addEventListener("mouseenter", this.removeDropDownTimeId);
|
|
231
198
|
}
|
|
232
199
|
this._selectDropdown.appendChild(this._selectionDropdown);
|
|
233
200
|
this._selectionDropdown.style.setProperty("display", "none");
|
|
@@ -290,16 +257,10 @@ class Select extends HTMLElement {
|
|
|
290
257
|
);
|
|
291
258
|
this._activeOption = selectOptionItem;
|
|
292
259
|
} else {
|
|
293
|
-
selectOptionItem.setAttribute(
|
|
294
|
-
"class",
|
|
295
|
-
"ranui-select-dropdown-option-item"
|
|
296
|
-
);
|
|
260
|
+
selectOptionItem.setAttribute("class", "ranui-select-dropdown-option-item");
|
|
297
261
|
}
|
|
298
262
|
const selectOptionItemContent = document.createElement("div");
|
|
299
|
-
selectOptionItemContent.setAttribute(
|
|
300
|
-
"class",
|
|
301
|
-
"ranui-select-dropdown-option-item-content"
|
|
302
|
-
);
|
|
263
|
+
selectOptionItemContent.setAttribute("class", "ranui-select-dropdown-option-item-content");
|
|
303
264
|
selectOptionItemContent.innerHTML = `${label}`;
|
|
304
265
|
selectOptionItemContent.setAttribute("value", `${value}`);
|
|
305
266
|
selectOptionItemContent.setAttribute("title", `${label}`);
|
|
@@ -348,12 +309,12 @@ class Select extends HTMLElement {
|
|
|
348
309
|
});
|
|
349
310
|
__publicField(this, "setShowSearch", () => {
|
|
350
311
|
this.onSearch = searchThrottle(this.changeSearch);
|
|
351
|
-
this._search.addEventListener("change", this.onSearch);
|
|
352
|
-
this._search.addEventListener("click", this.onSearch);
|
|
312
|
+
this.onSearch && this._search.addEventListener("change", this.onSearch);
|
|
313
|
+
this.onSearch && this._search.addEventListener("click", this.onSearch);
|
|
353
314
|
});
|
|
354
315
|
__publicField(this, "removeShowSearch", () => {
|
|
355
|
-
this._search.removeEventListener("change", this.onSearch);
|
|
356
|
-
this._search.removeEventListener("click", this.onSearch);
|
|
316
|
+
this.onSearch && this._search.removeEventListener("change", this.onSearch);
|
|
317
|
+
this.onSearch && this._search.removeEventListener("click", this.onSearch);
|
|
357
318
|
});
|
|
358
319
|
__publicField(this, "listenSlotChange", () => {
|
|
359
320
|
this._slot.addEventListener("slotchange", this.addOptionToSlot);
|
|
@@ -366,15 +327,19 @@ class Select extends HTMLElement {
|
|
|
366
327
|
this.removeEventListener("mouseleave", this.selectBlur);
|
|
367
328
|
this.removeEventListener("click", this.selectMouseDown);
|
|
368
329
|
this.removeEventListener("blur", this.selectBlur);
|
|
369
|
-
if (this.
|
|
330
|
+
if (this.trigger.includes("hover") && !isMobile()) {
|
|
370
331
|
this.addEventListener("mouseenter", this.selectMouseDown);
|
|
371
332
|
this.addEventListener("mouseleave", this.selectBlur);
|
|
372
333
|
}
|
|
373
|
-
if (this.
|
|
334
|
+
if (this.trigger.includes("click")) {
|
|
374
335
|
this.addEventListener("click", this.selectMouseDown);
|
|
375
336
|
this.addEventListener("blur", this.selectBlur);
|
|
376
337
|
}
|
|
377
338
|
});
|
|
339
|
+
__publicField(this, "clickRemoveSelect", (e) => {
|
|
340
|
+
e.stopPropagation();
|
|
341
|
+
this.setSelectDropdownDisplayNone();
|
|
342
|
+
});
|
|
378
343
|
this._slot = document.createElement("slot");
|
|
379
344
|
this._select = document.createElement("div");
|
|
380
345
|
this._select.setAttribute("class", "ran-select");
|
|
@@ -391,7 +356,7 @@ class Select extends HTMLElement {
|
|
|
391
356
|
this._text = document.createElement("span");
|
|
392
357
|
this._text.setAttribute("class", "selection-item");
|
|
393
358
|
this._text.setAttribute("part", "selection-item");
|
|
394
|
-
this._icon = document.createElement("
|
|
359
|
+
this._icon = document.createElement("ra-icon");
|
|
395
360
|
this._icon.setAttribute("class", "icon");
|
|
396
361
|
this._icon.setAttribute("part", "icon");
|
|
397
362
|
this._icon.setAttribute("name", "arrow-down");
|
|
@@ -412,7 +377,7 @@ class Select extends HTMLElement {
|
|
|
412
377
|
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
413
378
|
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
414
379
|
this._shadowDom = shadowRoot;
|
|
415
|
-
|
|
380
|
+
this._shadowDom.appendChild(this._select);
|
|
416
381
|
}
|
|
417
382
|
static get observedAttributes() {
|
|
418
383
|
return [
|
|
@@ -428,7 +393,7 @@ class Select extends HTMLElement {
|
|
|
428
393
|
// 挂载的节点
|
|
429
394
|
"dropdownclass",
|
|
430
395
|
// 弹窗的类名
|
|
431
|
-
"
|
|
396
|
+
"trigger"
|
|
432
397
|
// 触发下拉框的行为, click 还是 hover ,hover 在 isMobile 移动端无效
|
|
433
398
|
];
|
|
434
399
|
}
|
|
@@ -484,11 +449,11 @@ class Select extends HTMLElement {
|
|
|
484
449
|
set dropdownclass(value) {
|
|
485
450
|
this.setAttribute("dropdownclass", value || "");
|
|
486
451
|
}
|
|
487
|
-
get
|
|
488
|
-
return this.getAttribute("
|
|
452
|
+
get trigger() {
|
|
453
|
+
return this.getAttribute("trigger") || "click";
|
|
489
454
|
}
|
|
490
|
-
set
|
|
491
|
-
this.setAttribute("
|
|
455
|
+
set trigger(value) {
|
|
456
|
+
this.setAttribute("trigger", value || "");
|
|
492
457
|
}
|
|
493
458
|
get disabled() {
|
|
494
459
|
return isDisabled(this);
|
|
@@ -509,9 +474,7 @@ class Select extends HTMLElement {
|
|
|
509
474
|
sheet.insertRule(this.sheet);
|
|
510
475
|
this._shadowDom.adoptedStyleSheets = [sheet];
|
|
511
476
|
} catch (error) {
|
|
512
|
-
console.error(
|
|
513
|
-
`Failed to parse the rule in CSSStyleSheet: ${this.sheet}`
|
|
514
|
-
);
|
|
477
|
+
console.error(`Failed to parse the rule in CSSStyleSheet: ${this.sheet}`);
|
|
515
478
|
}
|
|
516
479
|
}
|
|
517
480
|
}
|
|
@@ -521,6 +484,7 @@ class Select extends HTMLElement {
|
|
|
521
484
|
this.listenActionEvent();
|
|
522
485
|
this.listenSlotChange();
|
|
523
486
|
this.setShowSearch();
|
|
487
|
+
document.addEventListener("click", this.clickRemoveSelect);
|
|
524
488
|
}
|
|
525
489
|
disconnectCallback() {
|
|
526
490
|
var _a;
|
|
@@ -531,6 +495,7 @@ class Select extends HTMLElement {
|
|
|
531
495
|
this.removeSelectDropdown();
|
|
532
496
|
(_a = this._selectDropdown) == null ? void 0 : _a.removeEventListener("click", this.clickOption);
|
|
533
497
|
this.removeListenSlotChange();
|
|
498
|
+
document.removeEventListener("click", this.clickRemoveSelect);
|
|
534
499
|
}
|
|
535
500
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
536
501
|
if (name === "disabled" && this._select) {
|