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