ranui 0.1.9 → 0.1.10-alpha.2
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-D4qr4m33.js +30 -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/content.js +6 -0
- package/dist/docx-CChZ5Ycr.js +3665 -0
- package/dist/global-DOOKQmNv.js +4 -0
- package/dist/icon.js +6 -0
- package/dist/iconShadowless.js +6 -0
- package/dist/image.js +4 -0
- package/dist/index-01Qfd9QI.js +207 -0
- package/dist/{index-2d16a084.js → index-B2yRe66F.js} +8 -10
- package/dist/{index-3cf72afd.js → index-B4bfIbdI.js} +9 -23
- package/dist/{index-458debf7.js → index-BF8tJ6rR.js} +7 -31
- package/dist/{index-7b8840f9.js → index-BHmWrPCW.js} +223 -1011
- package/dist/{index-e03d23e7.js → index-BpOERe9M.js} +1 -1
- package/dist/{index-e2e5d725.js → index-ByBbFhvo.js} +123 -323
- package/dist/index-C-p_Wpit.js +103 -0
- package/dist/{index-b7790662.js → index-C1x9Popy.js} +1 -1
- package/dist/index-C6wPL-2Y.js +298 -0
- package/dist/{index-1048a998.js → index-CFnsLnrb.js} +68 -19
- package/dist/{index-57492b9b.js → index-CSnBqUsQ.js} +48 -1
- package/dist/index-CWWI8SHO.js +206 -0
- package/dist/index-Cbp6LrE5.js +501 -0
- package/dist/index-CbyMC6Yz.js +59 -0
- package/dist/index-Cr9AYoGT.js +498 -0
- package/dist/index-DLB8VOy7.js +281 -0
- package/dist/index-DRWOSfdF.js +521 -0
- package/dist/{index-4443363f.js → index-DRi1ylHx.js} +29 -50
- package/dist/index-Dapt713u.js +65624 -0
- package/dist/{index-7216d6b0.js → index-DqtzBqPN.js} +11 -29
- package/dist/{index-1b73beee.js → index-DsIUhdNt.js} +55 -90
- package/dist/{index-01b17e26.js → index-Du-Biu-I.js} +1 -1
- package/dist/{index-0d5b9435.js → index-DytfjwBV.js} +2 -2
- package/dist/index.js +25 -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-DD9Dc6z4.js +2674 -0
- package/dist/loading.js +6 -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-DpNqCylD.js} +12 -4
- 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/shadowless/shadowless/index.js +14 -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-74Icp-PI.js +541 -0
- package/package.json +54 -24
- package/readme.md +18 -14
- package/typings.d.ts +101 -0
- package/dist/build/config.d.ts +0 -3
- package/dist/build/config.es.d.ts +0 -2
- package/dist/build/config.umd.d.ts +0 -2
- package/dist/components/button/index.d.ts +0 -35
- package/dist/components/button/index.js +0 -8
- package/dist/components/form/index.d.ts +0 -2
- package/dist/components/icon/index.d.ts +0 -2
- package/dist/components/icon/index.js +0 -6
- package/dist/components/image/index.d.ts +0 -2
- package/dist/components/image/index.js +0 -4
- package/dist/components/input/index.d.ts +0 -185
- package/dist/components/input/index.js +0 -6
- package/dist/components/message/index.d.ts +0 -14
- package/dist/components/message/index.js +0 -4
- package/dist/components/modal/index.d.ts +0 -2
- package/dist/components/modal/index.js +0 -4
- package/dist/components/option/index.d.ts +0 -2
- package/dist/components/player/index.d.ts +0 -213
- package/dist/components/player/index.js +0 -12
- package/dist/components/preview/colz.d.ts +0 -72
- package/dist/components/preview/docx.d.ts +0 -8
- package/dist/components/preview/excel/excel.d.ts +0 -2
- package/dist/components/preview/excel/index.d.ts +0 -1
- package/dist/components/preview/excel/media.d.ts +0 -37
- package/dist/components/preview/index.d.ts +0 -6
- package/dist/components/preview/index.js +0 -8
- package/dist/components/preview/pdf.d.ts +0 -1
- package/dist/components/preview/pptx/index.d.ts +0 -16
- package/dist/components/preview/pptx/process_pptx.d.ts +0 -23
- package/dist/components/preview/pptx/t_xml.d.ts +0 -1
- package/dist/components/preview/pptx/worker.d.ts +0 -1
- package/dist/components/progress/index.d.ts +0 -36
- package/dist/components/progress/index.js +0 -8
- package/dist/components/radar/index.d.ts +0 -2
- package/dist/components/radar/index.js +0 -7
- package/dist/components/scratch/index.d.ts +0 -19
- package/dist/components/select/index.d.ts +0 -105
- package/dist/components/select/index.js +0 -11
- package/dist/components/skeleton/index.d.ts +0 -2
- package/dist/components/skeleton/index.js +0 -4
- package/dist/components/tab/index.d.ts +0 -408
- package/dist/components/tab/index.js +0 -7
- package/dist/components/tabpane/index.d.ts +0 -352
- 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-7913ec46.js +0 -239
- package/dist/index-c14450a9.js +0 -662
- package/dist/index.d.ts +0 -14
- package/dist/info-circle-fill-90ec9aa9.js +0 -14
- package/dist/playwright.config.d.ts +0 -9
- package/dist/plugins/auto-import-file.d.ts +0 -0
- package/dist/plugins/load-style.d.ts +0 -6
- package/dist/plugins/load-svg.d.ts +0 -9
- package/dist/tests/button.spec.d.ts +0 -1
- package/dist/umd/build/config.d.ts +0 -3
- package/dist/umd/build/config.es.d.ts +0 -2
- 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/image/index.d.ts +0 -2
- package/dist/umd/components/input/index.d.ts +0 -185
- 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/select/index.d.ts +0 -105
- 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/utils/image.d.ts +0 -32
- package/dist/utils/index.d.ts +0 -64
- package/dist/utils/math.d.ts +0 -26
- package/dist/utils/tween.d.ts +0 -21
- package/dist/vendor-f71e6f68.js +0 -92126
- package/dist/vite.config.d.ts +0 -6
- /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
- /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +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
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { H as HTMLElementSSR, c as createCustomError } from "./index-CSnBqUsQ.js";
|
|
8
|
+
class Popover extends HTMLElementSSR() {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
__publicField(this, "_slot");
|
|
12
|
+
__publicField(this, "popoverBlock");
|
|
13
|
+
__publicField(this, "popoverContent");
|
|
14
|
+
__publicField(this, "popoverArrow");
|
|
15
|
+
__publicField(this, "popoverInner");
|
|
16
|
+
__publicField(this, "popoverInnerBlock");
|
|
17
|
+
__publicField(this, "removePopoverTimeId");
|
|
18
|
+
__publicField(this, "createContent", (content) => {
|
|
19
|
+
if (!content)
|
|
20
|
+
return;
|
|
21
|
+
if (!this.popoverContent) {
|
|
22
|
+
const div = document.createElement("div");
|
|
23
|
+
this.popoverContent = document.createElement("div");
|
|
24
|
+
this.popoverContent.setAttribute("class", "ran-popover-content");
|
|
25
|
+
this.popoverContent.addEventListener("click", this.clickContent);
|
|
26
|
+
this.popoverArrow = document.createElement("div");
|
|
27
|
+
this.popoverArrow.setAttribute("class", "ran-popover-content-arrow");
|
|
28
|
+
this.popoverInner = document.createElement("div");
|
|
29
|
+
this.popoverInner.setAttribute("class", "ran-popover-content-inner");
|
|
30
|
+
this.popoverInnerBlock = document.createElement("div");
|
|
31
|
+
this.popoverInnerBlock.setAttribute("class", "ran-popover-content-inner-block");
|
|
32
|
+
this.popoverContent.appendChild(this.popoverArrow);
|
|
33
|
+
this.popoverContent.appendChild(this.popoverInner);
|
|
34
|
+
this.popoverInner.appendChild(this.popoverInnerBlock);
|
|
35
|
+
div.appendChild(this.popoverContent);
|
|
36
|
+
document.body.appendChild(div);
|
|
37
|
+
}
|
|
38
|
+
if (this.popoverInnerBlock && content.length > 0) {
|
|
39
|
+
this.popoverInnerBlock.innerHTML = "";
|
|
40
|
+
const Fragment = document.createDocumentFragment();
|
|
41
|
+
for (const child of content) {
|
|
42
|
+
Fragment.appendChild(child);
|
|
43
|
+
}
|
|
44
|
+
this.popoverInnerBlock.appendChild(Fragment);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
__publicField(this, "watchContent", (e) => {
|
|
48
|
+
const { value } = e.detail;
|
|
49
|
+
this.createContent(value.content);
|
|
50
|
+
this.placementPosition();
|
|
51
|
+
});
|
|
52
|
+
__publicField(this, "placementPosition", () => {
|
|
53
|
+
var _a, _b, _c, _d;
|
|
54
|
+
if (!this.popoverInnerBlock || !this.popoverContent)
|
|
55
|
+
return;
|
|
56
|
+
(_a = this.popoverContent) == null ? void 0 : _a.style.setProperty("display", "block");
|
|
57
|
+
(_b = this.popoverContent) == null ? void 0 : _b.style.setProperty("opacity", "1");
|
|
58
|
+
const rect = this.getBoundingClientRect();
|
|
59
|
+
const { top, left, bottom, width } = rect;
|
|
60
|
+
this.popoverContent.style.setProperty("--ran-x", `${(left + window.scrollX).toFixed(2)}px`);
|
|
61
|
+
this.popoverContent.style.setProperty("--ran-y", `${(top + window.scrollY).toFixed(2)}px`);
|
|
62
|
+
let popoverTop = bottom + window.scrollY;
|
|
63
|
+
let popoverLeft = left + window.scrollX;
|
|
64
|
+
const root = document.getElementById(this.getPopupContainerId);
|
|
65
|
+
const arrowHeight = 8;
|
|
66
|
+
let popoverArrowTransform = `translateX(-50%) translateY(-40%) rotate(0deg)`;
|
|
67
|
+
let popoverArrowTop = -arrowHeight;
|
|
68
|
+
let popoverArrowLeft = left + this.popoverContent.clientWidth / 2 - arrowHeight / 2;
|
|
69
|
+
if (this.placement === "top") {
|
|
70
|
+
popoverTop = top + window.scrollY - this.popoverContent.clientHeight - arrowHeight;
|
|
71
|
+
if (this.getPopupContainerId && root) {
|
|
72
|
+
popoverTop = top - root.getBoundingClientRect().top - this.popoverContent.clientHeight;
|
|
73
|
+
popoverLeft = left - root.getBoundingClientRect().left;
|
|
74
|
+
}
|
|
75
|
+
popoverArrowTransform = "translateX(-50%) translateY(40%) rotate(180deg)";
|
|
76
|
+
popoverArrowTop = this.popoverContent.clientHeight - arrowHeight;
|
|
77
|
+
popoverArrowLeft = width / 2;
|
|
78
|
+
}
|
|
79
|
+
(_c = this.popoverArrow) == null ? void 0 : _c.style.setProperty("inset", `${popoverArrowTop}px auto auto ${popoverArrowLeft}px`);
|
|
80
|
+
(_d = this.popoverArrow) == null ? void 0 : _d.style.setProperty("transform", popoverArrowTransform);
|
|
81
|
+
this.popoverContent.style.setProperty("inset", `${popoverTop}px auto auto ${popoverLeft}px`);
|
|
82
|
+
});
|
|
83
|
+
__publicField(this, "hoverPopover", () => {
|
|
84
|
+
if (this.removePopoverTimeId) {
|
|
85
|
+
clearTimeout(this.removePopoverTimeId);
|
|
86
|
+
this.removePopoverTimeId = void 0;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
__publicField(this, "clickContent", (e) => {
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
});
|
|
92
|
+
__publicField(this, "clickPopover", (e) => {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
this.placementPosition();
|
|
95
|
+
});
|
|
96
|
+
__publicField(this, "clickRemovePopover", () => {
|
|
97
|
+
this.hoverRemovePopover();
|
|
98
|
+
});
|
|
99
|
+
__publicField(this, "popoverTrigger", () => {
|
|
100
|
+
this.removeEventListener("mouseenter", this.hoverPopover);
|
|
101
|
+
this.removeEventListener("click", this.hoverPopover);
|
|
102
|
+
this.removeEventListener("mouseleave", this.hoverRemovePopover);
|
|
103
|
+
this.removeEventListener("click", this.clickPopover);
|
|
104
|
+
document.removeEventListener("click", this.clickRemovePopover);
|
|
105
|
+
if (this.trigger === "hover") {
|
|
106
|
+
this.addEventListener("mouseenter", this.placementPosition);
|
|
107
|
+
this.addEventListener("mouseleave", this.hoverRemovePopover);
|
|
108
|
+
} else {
|
|
109
|
+
this.addEventListener("click", this.clickPopover);
|
|
110
|
+
document.addEventListener("click", this.clickRemovePopover);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
__publicField(this, "hoverRemovePopover", () => {
|
|
114
|
+
if (this.removePopoverTimeId) {
|
|
115
|
+
clearTimeout(this.removePopoverTimeId);
|
|
116
|
+
this.removePopoverTimeId = void 0;
|
|
117
|
+
}
|
|
118
|
+
this.removePopoverTimeId = setTimeout(() => {
|
|
119
|
+
var _a;
|
|
120
|
+
(_a = this.popoverContent) == null ? void 0 : _a.style.setProperty("opacity", "0");
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
var _a2;
|
|
123
|
+
(_a2 = this.popoverContent) == null ? void 0 : _a2.style.setProperty("display", "none");
|
|
124
|
+
}, 300);
|
|
125
|
+
}, 100);
|
|
126
|
+
});
|
|
127
|
+
this._slot = document.createElement("slot");
|
|
128
|
+
this.popoverBlock = document.createElement("div");
|
|
129
|
+
this.popoverBlock.setAttribute("class", "ran-popover-block");
|
|
130
|
+
this.popoverBlock.setAttribute("role", "tooltip");
|
|
131
|
+
this.popoverBlock.appendChild(this._slot);
|
|
132
|
+
}
|
|
133
|
+
static get observedAttributes() {
|
|
134
|
+
return ["placement", "arrow", "trigger"];
|
|
135
|
+
}
|
|
136
|
+
get placement() {
|
|
137
|
+
return this.getAttribute("placement") || "top";
|
|
138
|
+
}
|
|
139
|
+
set placement(value) {
|
|
140
|
+
this.setAttribute("placement", value);
|
|
141
|
+
}
|
|
142
|
+
get arrow() {
|
|
143
|
+
return this.getAttribute("arrow") || "";
|
|
144
|
+
}
|
|
145
|
+
set arrow(value) {
|
|
146
|
+
this.setAttribute("arrow", value);
|
|
147
|
+
}
|
|
148
|
+
get trigger() {
|
|
149
|
+
return this.getAttribute("trigger") || "";
|
|
150
|
+
}
|
|
151
|
+
set trigger(value) {
|
|
152
|
+
this.setAttribute("trigger", value);
|
|
153
|
+
}
|
|
154
|
+
get getPopupContainerId() {
|
|
155
|
+
return this.getAttribute("getPopupContainerId") || "";
|
|
156
|
+
}
|
|
157
|
+
set getPopupContainerId(value) {
|
|
158
|
+
this.setAttribute("getPopupContainerId", value);
|
|
159
|
+
}
|
|
160
|
+
connectedCallback() {
|
|
161
|
+
this.setAttribute("class", "ran-popover");
|
|
162
|
+
this.appendChild(this.popoverBlock);
|
|
163
|
+
for (const element of this.children) {
|
|
164
|
+
if (element.tagName === "R-CONTENT") {
|
|
165
|
+
element.addEventListener("change", this.watchContent);
|
|
166
|
+
this.createContent(element.children);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
this.popoverTrigger();
|
|
170
|
+
}
|
|
171
|
+
disconnectCallback() {
|
|
172
|
+
var _a;
|
|
173
|
+
this.removeEventListener("mouseenter", this.hoverPopover);
|
|
174
|
+
this.removeEventListener("mouseleave", this.hoverRemovePopover);
|
|
175
|
+
this.removeEventListener("click", this.hoverPopover);
|
|
176
|
+
this.removeEventListener("click", this.placementPosition);
|
|
177
|
+
document.removeEventListener("click", this.clickRemovePopover);
|
|
178
|
+
(_a = this.popoverContent) == null ? void 0 : _a.removeEventListener("click", this.clickContent);
|
|
179
|
+
}
|
|
180
|
+
attributeChangedCallback(n, o, v) {
|
|
181
|
+
if (o !== v) {
|
|
182
|
+
if (n === "trigger") {
|
|
183
|
+
this.popoverTrigger();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function Custom() {
|
|
189
|
+
if (typeof document !== "undefined" && !customElements.get("r-popover")) {
|
|
190
|
+
customElements.define("r-popover", Popover);
|
|
191
|
+
return Popover;
|
|
192
|
+
} else {
|
|
193
|
+
return createCustomError("document is undefined or r-popover is exist");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const index = Custom();
|
|
197
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
198
|
+
__proto__: null,
|
|
199
|
+
Popover,
|
|
200
|
+
default: index
|
|
201
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
202
|
+
export {
|
|
203
|
+
Popover as P,
|
|
204
|
+
index as a,
|
|
205
|
+
index$1 as i
|
|
206
|
+
};
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { H as HTMLElementSSR, i as isDisabled, f as falseList, c as createCustomError } from "./index-CSnBqUsQ.js";
|
|
8
|
+
const f7170ee498e0dd32cbdcb63fba8f75cc = '.remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.ran-input{position:relative;display:flex;width:var(--ran-input-width, calc(100% - 16px) );height:var(--ran-input-height, calc(100% - 4px) );min-width:0;padding:var(--ran-input-padding, 2px 8px);color:#000000d9;font-size:var(--ran-input-font-size, 12px);line-height:var(--ran-input-line-height, 1.5715);background-color:var(--ran-input-background-color, #fff);background-image:var(--ran-input-background-image, none);border:var(--ran-input-border, 1px solid #d9d9d9);border-radius:var(--ran-input-border-radius, 2px);transition:var(--ran-input-transition, all .3s)}.ran-input .ran-icon{display:flex;align-items:center;justify-content:center}.ran-input:active{border-color:#40a9ff;box-shadow:0 0 0 2px #1890ff33;border-right-width:1px;outline:0}.ran-input:hover{border-color:#40a9ff;border-right-width:1px}.ran-input>.ran-input-content:hover~.ran-input-label{color:#40a9ff}.ran-input[value]>.ran-input-label{transform:translateY(calc(-50% - .43em)) scale(.8);color:#00000040}.ran-input[status=error]{border-color:#ff4d4f}.ran-input[status=error]>.ran-input-content~.ran-input-label{color:#ff4d4f}.ran-input[status=warning]{border-color:#ff7875}.ran-input[status=warning]>.ran-input-content~.ran-input-label{color:#ff7875}.ran-input[disabled]{color:#00000040;background-color:#f5f5f5;border-color:#d9d9d9;box-shadow:none;cursor:not-allowed;opacity:1}.ran-input[disabled]>.ran-input-content{color:#00000040;background-color:#f5f5f5;border-color:#d9d9d9;box-shadow:none;cursor:not-allowed;opacity:1}.ran-input[disabled]>.ran-input-content~.ran-input-label{color:#00000040;background-color:#f5f5f5}.ran-input[disabled]>.ran-input-label{color:#999;border-color:#d9d9d9;box-shadow:none;cursor:not-allowed}.ran-input-content{writing-mode:horizontal-tb;text-rendering:auto;letter-spacing:normal;word-spacing:normal;text-transform:none;text-indent:0px;text-shadow:none;text-align:start;-webkit-rtl-ordering:logical;cursor:text;touch-action:manipulation;-webkit-appearance:none;text-overflow:ellipsis;box-sizing:border-box;margin:0;font-variant:tabular-nums;list-style:none;font-feature-settings:"tnum";position:relative;border:none;width:100%;min-width:0;color:#000000d9;font-size:14px;line-height:1.48;background-color:#fff;background-image:none;transition:all .3s;outline:none}.ran-input-content:focus,.ran-input-content:hover{border:none;outline:0}.ran-input-content::placeholder{color:#999}.ran-input-content:placeholder-shown~.ran-input-label{transform:translateY(calc(-50% - .43em)) scale(.8)}.ran-input-content:focus~.ran-input-label{transform:translateY(calc(-50% - .43em)) scale(.8)}.ran-input-content::-webkit-search-cancel-button{display:none;-webkit-appearance:none}.ran-input-label{pointer-events:none;position:absolute;font-size:14px;left:8px;transition:transform .3s,color .3s,background-color .3s,backdrop-filter .3s;transform-origin:left;padding:0 .2em;color:#999;background:#fff;opacity:.9}';
|
|
9
|
+
class Input extends HTMLElementSSR() {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
__publicField(this, "_input");
|
|
13
|
+
__publicField(this, "_label");
|
|
14
|
+
__publicField(this, "_inputContent");
|
|
15
|
+
__publicField(this, "_icon");
|
|
16
|
+
/**
|
|
17
|
+
* @description: 原生的 input 方法
|
|
18
|
+
* @param {Event} event
|
|
19
|
+
*/
|
|
20
|
+
__publicField(this, "customInput", (event) => {
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
const { target, data = "" } = event;
|
|
24
|
+
this.value = (target == null ? void 0 : target.value) || data || "";
|
|
25
|
+
this.customChange();
|
|
26
|
+
this.dispatchEvent(
|
|
27
|
+
new CustomEvent("input", {
|
|
28
|
+
detail: {
|
|
29
|
+
value: this.value
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* @description: 增加 change 方法,同时兼容大小写的情况
|
|
36
|
+
*/
|
|
37
|
+
__publicField(this, "customChange", () => {
|
|
38
|
+
this.dispatchEvent(
|
|
39
|
+
new CustomEvent("change", {
|
|
40
|
+
detail: {
|
|
41
|
+
value: this.value
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* @description: 监听 placeholder 属性函数
|
|
48
|
+
* @param {string} name
|
|
49
|
+
* @param {string} value
|
|
50
|
+
*/
|
|
51
|
+
__publicField(this, "listenPlaceholder", (name, value) => {
|
|
52
|
+
if (name === "placeholder" && this._inputContent) {
|
|
53
|
+
if (value != null) {
|
|
54
|
+
this._inputContent.setAttribute("placeholder", value);
|
|
55
|
+
} else {
|
|
56
|
+
this._inputContent.removeAttribute("placeholder");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* @description: 监听 label 属性函数
|
|
62
|
+
* @param {string} name
|
|
63
|
+
* @param {string} value
|
|
64
|
+
*/
|
|
65
|
+
__publicField(this, "listenLabel", (name, value) => {
|
|
66
|
+
if (name === "label" && this._inputContent) {
|
|
67
|
+
if (value != null) {
|
|
68
|
+
if (this._label) {
|
|
69
|
+
this._label.innerHTML = value;
|
|
70
|
+
} else {
|
|
71
|
+
this._label = document.createElement("label");
|
|
72
|
+
this._label.innerHTML = value;
|
|
73
|
+
this._label.setAttribute("class", "ran-input-label");
|
|
74
|
+
this._label.setAttribute("part", "ran-input-label");
|
|
75
|
+
this._input.appendChild(this._label);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
this._input.removeAttribute("label");
|
|
79
|
+
if (this._label) {
|
|
80
|
+
this._input.removeChild(this._label);
|
|
81
|
+
this._label = void 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* @description: 监听 type 属性
|
|
88
|
+
* @param {string} name
|
|
89
|
+
* @param {string} value
|
|
90
|
+
*/
|
|
91
|
+
__publicField(this, "listenType", (name, value) => {
|
|
92
|
+
if (name === "type" && this._inputContent) {
|
|
93
|
+
if (value) {
|
|
94
|
+
this._inputContent.setAttribute("type", value);
|
|
95
|
+
} else {
|
|
96
|
+
this._inputContent.removeAttribute("type");
|
|
97
|
+
this._inputContent.removeAttribute("min");
|
|
98
|
+
this._inputContent.removeAttribute("max");
|
|
99
|
+
this._inputContent.removeAttribute("step");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* @description: 监听 status 属性
|
|
105
|
+
* @param {string} name
|
|
106
|
+
* @param {string} value
|
|
107
|
+
*/
|
|
108
|
+
__publicField(this, "listenStatus", (name, value) => {
|
|
109
|
+
if (name === "status" && this._input) {
|
|
110
|
+
if (value) {
|
|
111
|
+
this._input.setAttribute("status", value);
|
|
112
|
+
} else {
|
|
113
|
+
this._input.removeAttribute("status");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* @description: 监听 disabled 属性
|
|
119
|
+
* @param {string} name
|
|
120
|
+
* @param {string} value
|
|
121
|
+
*/
|
|
122
|
+
__publicField(this, "listenDisabled", (name, value) => {
|
|
123
|
+
if (name === "disabled" && this._input) {
|
|
124
|
+
if (falseList.includes(value)) {
|
|
125
|
+
this._input.removeAttribute("disabled");
|
|
126
|
+
} else {
|
|
127
|
+
this._input.setAttribute("disabled", "");
|
|
128
|
+
this._inputContent.setAttribute("disabled", "");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
/**
|
|
133
|
+
* @description: 监听 icon 属性
|
|
134
|
+
* @param {string} name
|
|
135
|
+
* @param {string} value
|
|
136
|
+
*/
|
|
137
|
+
__publicField(this, "listenIcon", (name, value, oldValue) => {
|
|
138
|
+
if (name === "icon" && value && value !== oldValue) {
|
|
139
|
+
this.removeAttribute("label");
|
|
140
|
+
this.setAttribute("icon", value);
|
|
141
|
+
this.dealIcon();
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* @description: 处理 icon 属性的问题
|
|
146
|
+
*/
|
|
147
|
+
__publicField(this, "dealIcon", () => {
|
|
148
|
+
if (!this._icon) {
|
|
149
|
+
this._icon = document.createElement("ra-icon");
|
|
150
|
+
const { width, height } = this._inputContent.getBoundingClientRect();
|
|
151
|
+
const size = Math.min(width, height);
|
|
152
|
+
this._icon.setAttribute("size", `${size}`);
|
|
153
|
+
this._inputContent.insertAdjacentElement("beforebegin", this._icon);
|
|
154
|
+
}
|
|
155
|
+
this.icon && this._icon.setAttribute("name", this.icon);
|
|
156
|
+
});
|
|
157
|
+
/**
|
|
158
|
+
* @description: 聚合监听事件
|
|
159
|
+
* @param {string} name
|
|
160
|
+
* @param {string} oldValue
|
|
161
|
+
* @param {string} newValue
|
|
162
|
+
*/
|
|
163
|
+
__publicField(this, "listenEvent", (name, oldValue, newValue) => {
|
|
164
|
+
this.listenPlaceholder(name, newValue);
|
|
165
|
+
this.listenLabel(name, newValue);
|
|
166
|
+
this.listenStatus(name, newValue);
|
|
167
|
+
this.listenDisabled(name, newValue);
|
|
168
|
+
this.listenIcon(name, newValue, oldValue);
|
|
169
|
+
if (name === "value" && oldValue !== newValue) {
|
|
170
|
+
this._inputContent.value = newValue;
|
|
171
|
+
this._input.setAttribute("value", newValue);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
175
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
176
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
177
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
178
|
+
this._input = document.createElement("div");
|
|
179
|
+
this._input.setAttribute("class", "ran-input");
|
|
180
|
+
this._input.setAttribute("part", "ran-input");
|
|
181
|
+
this._inputContent = document.createElement("input");
|
|
182
|
+
this._inputContent.setAttribute("class", "ran-input-content");
|
|
183
|
+
this._inputContent.setAttribute("part", "ran-input-content");
|
|
184
|
+
this._input.appendChild(this._inputContent);
|
|
185
|
+
shadowRoot.appendChild(this._input);
|
|
186
|
+
}
|
|
187
|
+
static get observedAttributes() {
|
|
188
|
+
return [
|
|
189
|
+
"label",
|
|
190
|
+
"disabled",
|
|
191
|
+
"name",
|
|
192
|
+
"placeholder",
|
|
193
|
+
"type",
|
|
194
|
+
"icon",
|
|
195
|
+
"value",
|
|
196
|
+
"status",
|
|
197
|
+
// error warning normal
|
|
198
|
+
"prefix",
|
|
199
|
+
// 前缀
|
|
200
|
+
"suffix",
|
|
201
|
+
// 后缀
|
|
202
|
+
"allowclear",
|
|
203
|
+
// 清除 icon
|
|
204
|
+
"count",
|
|
205
|
+
// 计算输入的数量
|
|
206
|
+
"maxlength",
|
|
207
|
+
"showcount",
|
|
208
|
+
"onPressEnter",
|
|
209
|
+
// 按下回车的回调
|
|
210
|
+
"variant",
|
|
211
|
+
// filled borderless
|
|
212
|
+
"minrows",
|
|
213
|
+
// 当 type 等于 TextArea 时
|
|
214
|
+
"maxrows"
|
|
215
|
+
];
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* @description: 获取 input 的值
|
|
219
|
+
* @return {String}
|
|
220
|
+
*/
|
|
221
|
+
get value() {
|
|
222
|
+
return this.getAttribute("value") || "";
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* @description: 设置 input 的值
|
|
226
|
+
* @param {String} value
|
|
227
|
+
*/
|
|
228
|
+
set value(value) {
|
|
229
|
+
if (!isDisabled(this) && value) {
|
|
230
|
+
this.setAttribute("value", value);
|
|
231
|
+
this._input.setAttribute("value", value);
|
|
232
|
+
} else {
|
|
233
|
+
this.removeAttribute("value");
|
|
234
|
+
this._input.removeAttribute("value");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* @description: 获取 input 的占位字符
|
|
239
|
+
* @return {String}
|
|
240
|
+
*/
|
|
241
|
+
get placeholder() {
|
|
242
|
+
return this.getAttribute("placeholder") || "";
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* @description: 设置 input 的占位字符
|
|
246
|
+
* @param {String} value
|
|
247
|
+
*/
|
|
248
|
+
set placeholder(value) {
|
|
249
|
+
if (value) {
|
|
250
|
+
this.setAttribute("placeholder", value);
|
|
251
|
+
} else {
|
|
252
|
+
this.removeAttribute("placeholder");
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* @description: input 是否为必选
|
|
257
|
+
* @return {String}
|
|
258
|
+
*/
|
|
259
|
+
get required() {
|
|
260
|
+
return this.getAttribute("required") || "";
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* @description: 设置 input 是否为必选,除非设置成 false,否则都是必填
|
|
264
|
+
* @param {*} value
|
|
265
|
+
*/
|
|
266
|
+
set required(value) {
|
|
267
|
+
if (!value || value === "false") {
|
|
268
|
+
this.removeAttribute("required");
|
|
269
|
+
} else {
|
|
270
|
+
this.setAttribute("required", "");
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* @description: 获取 input 上 disabled 属性
|
|
275
|
+
* @return {String | null}
|
|
276
|
+
*/
|
|
277
|
+
get disabled() {
|
|
278
|
+
return `${isDisabled(this)}`;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* @description: 设置 input 的 disabled 属性
|
|
282
|
+
* @param {String} value
|
|
283
|
+
*/
|
|
284
|
+
set disabled(value) {
|
|
285
|
+
if (falseList.includes(value)) {
|
|
286
|
+
this.removeAttribute("disabled");
|
|
287
|
+
this._input.removeAttribute("disabled");
|
|
288
|
+
this._inputContent.removeAttribute("disabled");
|
|
289
|
+
} else {
|
|
290
|
+
this.setAttribute("disabled", "");
|
|
291
|
+
this._input.setAttribute("disabled", "");
|
|
292
|
+
this._inputContent.setAttribute("disabled", "");
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* @description: 获取类似于 Metiral Design 的输入体验。
|
|
297
|
+
*/
|
|
298
|
+
get label() {
|
|
299
|
+
return this.getAttribute("label") || "";
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* @description: 设置类似于 Metiral Design 的输入体验。
|
|
303
|
+
*/
|
|
304
|
+
set label(value) {
|
|
305
|
+
this.setAttribute("label", value);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* @description: 获取 input 框的状态
|
|
309
|
+
*/
|
|
310
|
+
get status() {
|
|
311
|
+
return this.getAttribute("status") || "";
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* @description: 设置 input 框的状态
|
|
315
|
+
*/
|
|
316
|
+
set status(value) {
|
|
317
|
+
if (value) {
|
|
318
|
+
this.setAttribute("status", value);
|
|
319
|
+
this._input.setAttribute("status", value);
|
|
320
|
+
} else {
|
|
321
|
+
this.removeAttribute("status");
|
|
322
|
+
this._input.removeAttribute("status");
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* @description: 与 form 组件联动时,收集的属性名
|
|
327
|
+
* @return {String}
|
|
328
|
+
*/
|
|
329
|
+
get name() {
|
|
330
|
+
return this.getAttribute("name") || "";
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* @description: 设置 name 属性
|
|
334
|
+
* @param {string} value
|
|
335
|
+
*/
|
|
336
|
+
set name(value) {
|
|
337
|
+
this.setAttribute("name", value);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* @description: 当 input 类型为 number 类型时,可以获取 min 属性
|
|
341
|
+
* @return {String}
|
|
342
|
+
*/
|
|
343
|
+
get min() {
|
|
344
|
+
return this.getAttribute("min") || "";
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* @description: 当 input 类型为 number 类型时,设置 min 属性
|
|
348
|
+
* @param {string} value
|
|
349
|
+
*/
|
|
350
|
+
set min(value) {
|
|
351
|
+
if (this.type === "number")
|
|
352
|
+
this.setAttribute("min", value);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* @description: 当 input 类型为 number 类型时,可以获取 max 属性
|
|
356
|
+
* @return {String}
|
|
357
|
+
*/
|
|
358
|
+
get max() {
|
|
359
|
+
return this.getAttribute("max") || "";
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* @description: 当 input 类型为 number 类型时,设置 max 属性
|
|
363
|
+
* @param {string} value
|
|
364
|
+
*/
|
|
365
|
+
set max(value) {
|
|
366
|
+
if (this.type === "number")
|
|
367
|
+
this.setAttribute("max", value);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* @description: 当 input 类型为 number 类型时,可以获取 step 属性
|
|
371
|
+
* @return {String}
|
|
372
|
+
*/
|
|
373
|
+
get step() {
|
|
374
|
+
return this.getAttribute("step") || "";
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* @description: 当 input 类型为 number 类型时,设置 step 属性
|
|
378
|
+
* @param {string} value
|
|
379
|
+
*/
|
|
380
|
+
set step(value) {
|
|
381
|
+
if (this.type === "number")
|
|
382
|
+
this.setAttribute("step", value);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* @description: 获取一个 icon
|
|
386
|
+
* @return {String}
|
|
387
|
+
*/
|
|
388
|
+
get icon() {
|
|
389
|
+
return this.getAttribute("icon") || "";
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* @description: 设置 icon 来表示标识
|
|
393
|
+
* @param {string|null} value
|
|
394
|
+
*/
|
|
395
|
+
set icon(value) {
|
|
396
|
+
if (value) {
|
|
397
|
+
this.setAttribute("icon", value);
|
|
398
|
+
} else {
|
|
399
|
+
this.removeAttribute("icon");
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* @description: 获取前面的 icon
|
|
404
|
+
* @return {String}
|
|
405
|
+
*/
|
|
406
|
+
get prefix() {
|
|
407
|
+
return this.getAttribute("prefix") || "";
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* @description: 设置前面的 icon 来表示标识
|
|
411
|
+
* @param {string|null} value
|
|
412
|
+
*/
|
|
413
|
+
set prefix(value) {
|
|
414
|
+
if (value) {
|
|
415
|
+
this.setAttribute("prefix", value);
|
|
416
|
+
} else {
|
|
417
|
+
this.removeAttribute("prefix");
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* @description: 获取后面的 icon
|
|
422
|
+
* @return {String}
|
|
423
|
+
*/
|
|
424
|
+
get suffix() {
|
|
425
|
+
return this.getAttribute("suffix") || "";
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* @description: 设置后面的 icon 来表示标识
|
|
429
|
+
* @param {string|null} value
|
|
430
|
+
*/
|
|
431
|
+
set suffix(value) {
|
|
432
|
+
if (value) {
|
|
433
|
+
this.setAttribute("suffix", value);
|
|
434
|
+
} else {
|
|
435
|
+
this.removeAttribute("suffix");
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* @description: 获取 input 的类型
|
|
440
|
+
* @return {string|null}
|
|
441
|
+
*/
|
|
442
|
+
get type() {
|
|
443
|
+
return this.getAttribute("type") || "";
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* @description: 设置 input 的类型
|
|
447
|
+
* @param {string|null} value
|
|
448
|
+
*/
|
|
449
|
+
set type(value) {
|
|
450
|
+
if (value) {
|
|
451
|
+
this.setAttribute("type", value);
|
|
452
|
+
} else {
|
|
453
|
+
this.removeAttribute("type");
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
connectedCallback() {
|
|
457
|
+
if (this.value) {
|
|
458
|
+
this._inputContent.value = this.value;
|
|
459
|
+
this._input.setAttribute("value", this.value);
|
|
460
|
+
}
|
|
461
|
+
if (this.status) {
|
|
462
|
+
this._input.setAttribute("status", this.status);
|
|
463
|
+
}
|
|
464
|
+
if (isDisabled(this)) {
|
|
465
|
+
this._input.setAttribute("disabled", "");
|
|
466
|
+
this._inputContent.setAttribute("disabled", "");
|
|
467
|
+
}
|
|
468
|
+
if (this.type) {
|
|
469
|
+
this._inputContent.setAttribute("type", this.type);
|
|
470
|
+
}
|
|
471
|
+
this._inputContent.addEventListener("input", this.customInput);
|
|
472
|
+
if (document.readyState === "complete") {
|
|
473
|
+
this.dealIcon();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
disconnectCallback() {
|
|
477
|
+
this._inputContent.removeEventListener("input", this.customInput);
|
|
478
|
+
}
|
|
479
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
480
|
+
this.listenEvent(name, oldValue, newValue);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
function Custom() {
|
|
484
|
+
if (typeof window !== "undefined" && !customElements.get("r-input")) {
|
|
485
|
+
customElements.define("r-input", Input);
|
|
486
|
+
return Input;
|
|
487
|
+
} else {
|
|
488
|
+
return createCustomError("document is undefined or r-input is exist");
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const index = Custom();
|
|
492
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
493
|
+
__proto__: null,
|
|
494
|
+
Input,
|
|
495
|
+
default: index
|
|
496
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
497
|
+
export {
|
|
498
|
+
Input as I,
|
|
499
|
+
index as a,
|
|
500
|
+
index$1 as i
|
|
501
|
+
};
|