ranui 0.1.5 → 0.1.7
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/add-user-b2bed3e7.js +4 -0
- package/dist/book-b11a68eb.js +4 -0
- package/dist/build/config.d.ts +3 -0
- package/dist/check-circle-74bd09c3.js +4 -0
- package/dist/check-circle-fill-dc284144.js +4 -0
- package/dist/close-20925345.js +4 -0
- package/dist/close-circle-720c18be.js +4 -0
- package/dist/close-circle-fill-238a66b1.js +4 -0
- package/dist/components/button/index.d.ts +1 -331
- package/dist/components/button/index.js +4 -2
- package/dist/components/icon/index.js +3 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.d.ts +1 -435
- package/dist/components/input/index.js +2 -2
- package/dist/components/message/index.d.ts +12 -6
- package/dist/components/message/index.js +1 -2
- package/dist/components/modal/index.js +4 -0
- package/dist/components/option/index.d.ts +2 -0
- package/dist/components/option/index.js +95 -0
- package/dist/components/{video → player}/index.d.ts +245 -114
- package/dist/components/player/index.js +11 -0
- package/dist/components/preview/colz.d.ts +1 -1
- package/dist/components/preview/excel/excel.d.ts +0 -9
- package/dist/components/preview/index.d.ts +4 -0
- package/dist/components/preview/index.js +5 -4
- package/dist/components/preview/pptx/process_pptx.d.ts +1 -1
- package/dist/components/progress/index.d.ts +36 -0
- package/dist/components/progress/index.js +8 -0
- package/dist/components/radar/index.d.ts +2 -0
- package/dist/components/radar/index.js +7 -0
- package/dist/components/select/index.d.ts +101 -0
- package/dist/components/select/index.js +11 -0
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/tab/index.d.ts +47 -27
- package/dist/components/tab/index.js +4 -2
- package/dist/components/tabpane/index.d.ts +47 -27
- package/dist/components/tabpane/index.js +1 -1
- package/dist/docx-c5d02d8c.js +21 -0
- package/dist/eye-5e742329.js +4 -0
- package/dist/eye-close-3874f1ae.js +4 -0
- package/dist/hls/5_1700986031916/5.key +1 -0
- package/dist/hls/5_1700986031916/5.m3u8 +12 -0
- package/dist/hls/5_1700986031916/5_00000.ts +0 -0
- package/dist/hls/5_1700986031916/5_00001.ts +0 -0
- package/dist/hls/5_1700986031916/5_00002.ts +0 -0
- package/dist/hls/5_1700986110178/5.key +1 -0
- package/dist/hls/5_1700986110178/5.m3u8 +12 -0
- package/dist/hls/5_1700986110178/5_00000.ts +0 -0
- package/dist/hls/5_1700986110178/5_00001.ts +0 -0
- package/dist/hls/5_1700986110178/5_00002.ts +0 -0
- package/dist/hls/example.m3u8 +5 -0
- package/dist/home-c4a05e8b.js +4 -0
- package/dist/index-0e7229ea.js +328 -0
- package/dist/index-183517e7.js +265 -0
- package/dist/index-48653b79.js +162 -0
- package/dist/index-4d873a42.js +195 -0
- package/dist/index-57492b9b.js +48 -0
- package/dist/index-5975bbc0.js +126 -0
- package/dist/index-7b8840f9.js +18690 -0
- package/dist/index-7f513a14.js +175 -0
- package/dist/index-8e1e2573.js +19 -0
- package/dist/index-a1a53af6.js +354 -0
- package/dist/index-a216f328.js +662 -0
- package/dist/index-a43b144f.js +232 -0
- package/dist/index-aea75a9f.js +78 -0
- package/dist/index-b2be6bef.js +10423 -0
- package/dist/index-b90299ca.js +43 -0
- package/dist/index-d2d69b06.js +225 -0
- package/dist/index-ecaed5cc.js +439 -0
- package/dist/index-f6d6982d.js +516 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +24 -12
- package/dist/info-circle-5826decc.js +4 -0
- package/dist/info-circle-fill-90ec9aa9.js +14 -0
- package/dist/loading-09ca52df.js +4 -0
- package/dist/lock-1d2487c9.js +4 -0
- package/dist/message-b2bfdea7.js +4 -0
- package/dist/{pdf-bd9a47ff.js → pdf-bdb7818a.js} +1 -2
- package/dist/playwright.config.d.ts +0 -2
- package/dist/plugins/auto-import-file.d.ts +0 -10
- package/dist/power-off-6ade5a91.js +4 -0
- package/dist/preview-b291aea8.js +4 -0
- package/dist/setting-1e5ccb6d.js +4 -0
- package/dist/style.css +1 -1
- package/dist/team-ca6a12e1.js +4 -0
- package/dist/umd/build/config.d.ts +3 -0
- package/dist/umd/components/button/index.d.ts +1 -331
- package/dist/umd/components/input/index.d.ts +1 -435
- package/dist/umd/components/message/index.d.ts +12 -6
- package/dist/umd/components/option/index.d.ts +2 -0
- package/dist/umd/components/{video → player}/index.d.ts +245 -114
- package/dist/umd/components/preview/colz.d.ts +1 -1
- package/dist/umd/components/preview/excel/excel.d.ts +0 -9
- package/dist/umd/components/preview/index.d.ts +4 -0
- package/dist/umd/components/preview/pptx/process_pptx.d.ts +1 -1
- package/dist/umd/components/progress/index.d.ts +36 -0
- package/dist/umd/components/radar/index.d.ts +2 -0
- package/dist/umd/components/select/index.d.ts +101 -0
- package/dist/umd/components/tab/index.d.ts +47 -27
- package/dist/umd/components/tabpane/index.d.ts +47 -27
- package/dist/umd/hls/5_1700986031916/5.key +1 -0
- package/dist/umd/hls/5_1700986031916/5.m3u8 +12 -0
- package/dist/umd/hls/5_1700986031916/5_00000.ts +0 -0
- package/dist/umd/hls/5_1700986031916/5_00001.ts +0 -0
- package/dist/umd/hls/5_1700986031916/5_00002.ts +0 -0
- package/dist/umd/hls/5_1700986110178/5.key +1 -0
- package/dist/umd/hls/5_1700986110178/5.m3u8 +12 -0
- package/dist/umd/hls/5_1700986110178/5_00000.ts +0 -0
- package/dist/umd/hls/5_1700986110178/5_00001.ts +0 -0
- package/dist/umd/hls/5_1700986110178/5_00002.ts +0 -0
- package/dist/umd/hls/example.m3u8 +5 -0
- package/dist/umd/index.d.ts +5 -0
- package/dist/umd/index.umd.cjs +26 -8
- package/dist/umd/playwright.config.d.ts +0 -2
- package/dist/umd/plugins/auto-import-file.d.ts +0 -10
- package/dist/umd/style.css +1 -1
- package/dist/umd/utils/image.d.ts +32 -0
- package/dist/umd/utils/index.d.ts +44 -17
- package/dist/umd/utils/math.d.ts +26 -0
- package/dist/umd/utils/tween.d.ts +21 -0
- package/dist/unlock-f56086fd.js +4 -0
- package/dist/user-5c01e665.js +4 -0
- package/dist/utils/image.d.ts +32 -0
- package/dist/utils/index.d.ts +44 -17
- package/dist/utils/math.d.ts +26 -0
- package/dist/utils/tween.d.ts +21 -0
- package/dist/{index-714a1eb8.js → vendor-f71e6f68.js} +7771 -1267
- package/dist/warning-circle-035e025c.js +4 -0
- package/dist/warning-circle-fill-d17c37c9.js +4 -0
- package/package.json +54 -7
- package/readme.md +78 -50
- package/dist/_commonjs-dynamic-modules-2ceabb0b.js +0 -12
- package/dist/add-user-d07564bd.js +0 -4
- package/dist/assets/image/failImage.d.ts +0 -2
- package/dist/base-bcc748a2.js +0 -1
- package/dist/book-2a5a596c.js +0 -4
- package/dist/check-circle-2c986969.js +0 -4
- package/dist/check-circle-fill-62eaa796.js +0 -4
- package/dist/close-circle-2afb6e94.js +0 -4
- package/dist/close-circle-fill-b6906239.js +0 -4
- package/dist/close-ee3ba1d1.js +0 -4
- package/dist/docx-5262a8f1.js +0 -2635
- package/dist/eye-bd60afe1.js +0 -4
- package/dist/eye-close-bde3c1fc.js +0 -4
- package/dist/home-f824d8f4.js +0 -4
- package/dist/index-00913cab.js +0 -43
- package/dist/index-03e90266.js +0 -455
- package/dist/index-105ed089.js +0 -127
- package/dist/index-1ffff466.js +0 -23077
- package/dist/index-2243317e.js +0 -155
- package/dist/index-441da303.js +0 -196
- package/dist/index-9861f093.js +0 -215
- package/dist/index-ac3f8c4f.js +0 -324
- package/dist/index-b580f377.js +0 -78
- package/dist/index-c61cbf56.js +0 -74
- package/dist/index-db03e134.js +0 -177
- package/dist/info-circle-59333e1c.js +0 -4
- package/dist/info-circle-fill-3ab7660d.js +0 -4
- package/dist/jszip.min-97cf7c6a.js +0 -2655
- package/dist/loading-407d8249.js +0 -4
- package/dist/lock-6d20715b.js +0 -4
- package/dist/message-ee4fe153.js +0 -4
- package/dist/power-off-bbec6b5f.js +0 -4
- package/dist/preview-164a4944.js +0 -4
- package/dist/setting-735a1963.js +0 -4
- package/dist/team-42573142.js +0 -4
- package/dist/umd/assets/image/failImage.d.ts +0 -2
- package/dist/unlock-ae33c6f7.js +0 -4
- package/dist/user-b7098183.js +0 -4
- package/dist/warning-circle-536d4749.js +0 -4
- package/dist/warning-circle-fill-e4be98bc.js +0 -4
|
@@ -0,0 +1,439 @@
|
|
|
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 { c as createCustomError, i as isDisabled, f as falseList } from "./index-57492b9b.js";
|
|
8
|
+
const f7170ee498e0dd32cbdcb63fba8f75cc = '.ran-input{position:relative;display:flex;width:calc(100% - 16px);height:calc(100% - 4px);min-width:0;padding:2px 8px;color:#000000d9;font-size:12px;line-height:1.5715;background-color:#fff;background-image:none;border-width:1px;border-style:solid;border-color:#d9d9d9;border-radius:2px;transition:all .3s}.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}\n';
|
|
9
|
+
function Custom() {
|
|
10
|
+
if (typeof window !== "undefined" && !customElements.get("r-input")) {
|
|
11
|
+
class CustomElement extends HTMLElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
__publicField(this, "_input");
|
|
15
|
+
__publicField(this, "_label");
|
|
16
|
+
__publicField(this, "_inputContent");
|
|
17
|
+
__publicField(this, "_icon");
|
|
18
|
+
/**
|
|
19
|
+
* @description: 原生的input方法
|
|
20
|
+
* @param {Event} event
|
|
21
|
+
*/
|
|
22
|
+
__publicField(this, "customInput", (event) => {
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
const target = event.target;
|
|
25
|
+
this.value = target ? target.value : "";
|
|
26
|
+
this.customChange();
|
|
27
|
+
this.dispatchEvent(
|
|
28
|
+
new CustomEvent("input", {
|
|
29
|
+
detail: {
|
|
30
|
+
value: this.value
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* @description: 增加change方法,同时兼容大小写的情况
|
|
37
|
+
*/
|
|
38
|
+
__publicField(this, "customChange", () => {
|
|
39
|
+
this.dispatchEvent(
|
|
40
|
+
new CustomEvent("change", {
|
|
41
|
+
detail: {
|
|
42
|
+
value: this.value
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* @description: 处理icon属性的问题
|
|
49
|
+
*/
|
|
50
|
+
__publicField(this, "dealIcon", () => {
|
|
51
|
+
if (!this._icon) {
|
|
52
|
+
this._icon = document.createElement("r-icon");
|
|
53
|
+
const { width, height } = this._inputContent.getBoundingClientRect();
|
|
54
|
+
const size = Math.min(width, height);
|
|
55
|
+
this._icon.setAttribute("size", `${size}`);
|
|
56
|
+
this._inputContent.insertAdjacentElement("beforebegin", this._icon);
|
|
57
|
+
}
|
|
58
|
+
this.icon && this._icon.setAttribute("name", this.icon);
|
|
59
|
+
});
|
|
60
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
61
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
62
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
63
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
64
|
+
this._input = document.createElement("div");
|
|
65
|
+
this._input.setAttribute("class", "ran-input");
|
|
66
|
+
this._input.setAttribute("part", "ran-input");
|
|
67
|
+
this._inputContent = document.createElement("input");
|
|
68
|
+
this._inputContent.setAttribute("class", "ran-input-content");
|
|
69
|
+
this._inputContent.setAttribute("part", "ran-input-content");
|
|
70
|
+
this._input.appendChild(this._inputContent);
|
|
71
|
+
shadowRoot.appendChild(this._input);
|
|
72
|
+
}
|
|
73
|
+
static get observedAttributes() {
|
|
74
|
+
return [
|
|
75
|
+
"label",
|
|
76
|
+
"disabled",
|
|
77
|
+
"name",
|
|
78
|
+
"placeholder",
|
|
79
|
+
"type",
|
|
80
|
+
"icon",
|
|
81
|
+
"status"
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @description: 获取input的值
|
|
86
|
+
* @return {String}
|
|
87
|
+
*/
|
|
88
|
+
get value() {
|
|
89
|
+
return this.getAttribute("value");
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @description: 设置input的值
|
|
93
|
+
* @param {String} value
|
|
94
|
+
*/
|
|
95
|
+
set value(value) {
|
|
96
|
+
if (!isDisabled(this) && value) {
|
|
97
|
+
this.setAttribute("value", value);
|
|
98
|
+
this._input.setAttribute("value", value);
|
|
99
|
+
} else {
|
|
100
|
+
this.removeAttribute("value");
|
|
101
|
+
this._input.removeAttribute("value");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @description: 获取input的占位字符
|
|
106
|
+
* @return {String}
|
|
107
|
+
*/
|
|
108
|
+
get placeholder() {
|
|
109
|
+
return this.getAttribute("placeholder");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @description: 设置input的占位字符
|
|
113
|
+
* @param {String} value
|
|
114
|
+
*/
|
|
115
|
+
set placeholder(value) {
|
|
116
|
+
if (value) {
|
|
117
|
+
this.setAttribute("placeholder", value);
|
|
118
|
+
} else {
|
|
119
|
+
this.removeAttribute("placeholder");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @description: input是否为必选
|
|
124
|
+
* @return {String}
|
|
125
|
+
*/
|
|
126
|
+
get required() {
|
|
127
|
+
return this.getAttribute("required");
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @description: 设置input是否为必选,除非设置成false,否则都是必填
|
|
131
|
+
* @param {*} value
|
|
132
|
+
*/
|
|
133
|
+
set required(value) {
|
|
134
|
+
if (!value || value === "false") {
|
|
135
|
+
this.removeAttribute("required");
|
|
136
|
+
} else {
|
|
137
|
+
this.setAttribute("required", "");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* @description: 获取input上disabled属性
|
|
142
|
+
* @return {String | null}
|
|
143
|
+
*/
|
|
144
|
+
get disabled() {
|
|
145
|
+
return isDisabled(this);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @description: 设置input的disabled属性
|
|
149
|
+
* @param {String} value
|
|
150
|
+
*/
|
|
151
|
+
set disabled(value) {
|
|
152
|
+
if (falseList.includes(value)) {
|
|
153
|
+
this.removeAttribute("disabled");
|
|
154
|
+
this._input.removeAttribute("disabled");
|
|
155
|
+
this._inputContent.removeAttribute("disabled");
|
|
156
|
+
} else {
|
|
157
|
+
this.setAttribute("disabled", "");
|
|
158
|
+
this._input.setAttribute("disabled", "");
|
|
159
|
+
this._inputContent.setAttribute("disabled", "");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @description: 获取类似于Metiral Design的输入体验。
|
|
164
|
+
*/
|
|
165
|
+
get label() {
|
|
166
|
+
return this.getAttribute("label") || "";
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* @description: 设置类似于Metiral Design的输入体验。
|
|
170
|
+
*/
|
|
171
|
+
set label(value) {
|
|
172
|
+
this.setAttribute("label", value);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @description: 获取input框的状态
|
|
176
|
+
*/
|
|
177
|
+
get status() {
|
|
178
|
+
return this.getAttribute("status") || "";
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @description: 设置input框的状态
|
|
182
|
+
*/
|
|
183
|
+
set status(value) {
|
|
184
|
+
if (value) {
|
|
185
|
+
this.setAttribute("status", value);
|
|
186
|
+
this._input.setAttribute("status", value);
|
|
187
|
+
} else {
|
|
188
|
+
this.removeAttribute("status");
|
|
189
|
+
this._input.removeAttribute("status");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @description: 与form组件联动时,收集的属性名
|
|
194
|
+
* @return {String}
|
|
195
|
+
*/
|
|
196
|
+
get name() {
|
|
197
|
+
return this.getAttribute("name") || "";
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @description: 设置name属性
|
|
201
|
+
* @param {string} value
|
|
202
|
+
*/
|
|
203
|
+
set name(value) {
|
|
204
|
+
this.setAttribute("name", value);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @description: 当input类型为number类型时,可以获取min属性
|
|
208
|
+
* @return {String}
|
|
209
|
+
*/
|
|
210
|
+
get min() {
|
|
211
|
+
return this.getAttribute("min") || "";
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @description: 当input类型为number类型时,设置min属性
|
|
215
|
+
* @param {string} value
|
|
216
|
+
*/
|
|
217
|
+
set min(value) {
|
|
218
|
+
if (this.type === "number")
|
|
219
|
+
this.setAttribute("min", value);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* @description: 当input类型为number类型时,可以获取max属性
|
|
223
|
+
* @return {String}
|
|
224
|
+
*/
|
|
225
|
+
get max() {
|
|
226
|
+
return this.getAttribute("max") || "";
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* @description: 当input类型为number类型时,设置max属性
|
|
230
|
+
* @param {string} value
|
|
231
|
+
*/
|
|
232
|
+
set max(value) {
|
|
233
|
+
if (this.type === "number")
|
|
234
|
+
this.setAttribute("max", value);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* @description: 当input类型为number类型时,可以获取step属性
|
|
238
|
+
* @return {String}
|
|
239
|
+
*/
|
|
240
|
+
get step() {
|
|
241
|
+
return this.getAttribute("step") || "";
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* @description: 当input类型为number类型时,设置step属性
|
|
245
|
+
* @param {string} value
|
|
246
|
+
*/
|
|
247
|
+
set step(value) {
|
|
248
|
+
if (this.type === "number")
|
|
249
|
+
this.setAttribute("step", value);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @description: 获取一个icon
|
|
253
|
+
* @return {String}
|
|
254
|
+
*/
|
|
255
|
+
get icon() {
|
|
256
|
+
return this.getAttribute("icon");
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* @description: 设置icon来表示标识
|
|
260
|
+
* @param {string|null} value
|
|
261
|
+
*/
|
|
262
|
+
set icon(value) {
|
|
263
|
+
if (value) {
|
|
264
|
+
this.setAttribute("icon", value);
|
|
265
|
+
} else {
|
|
266
|
+
this.removeAttribute("icon");
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* @description: 获取input的类型
|
|
271
|
+
* @return {string|null}
|
|
272
|
+
*/
|
|
273
|
+
get type() {
|
|
274
|
+
return this.getAttribute("type");
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @description: 设置input的类型
|
|
278
|
+
* @param {string|null} value
|
|
279
|
+
*/
|
|
280
|
+
set type(value) {
|
|
281
|
+
if (value) {
|
|
282
|
+
this.setAttribute("type", value);
|
|
283
|
+
} else {
|
|
284
|
+
this.removeAttribute("type");
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* @description: 监听placeholder属性函数
|
|
289
|
+
* @param {string} name
|
|
290
|
+
* @param {string} value
|
|
291
|
+
*/
|
|
292
|
+
listenPlaceholder(name, value) {
|
|
293
|
+
if (name === "placeholder" && this._inputContent) {
|
|
294
|
+
if (value != null) {
|
|
295
|
+
this._inputContent.setAttribute("placeholder", value);
|
|
296
|
+
} else {
|
|
297
|
+
this._inputContent.removeAttribute("placeholder");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* @description: 监听label属性函数
|
|
303
|
+
* @param {string} name
|
|
304
|
+
* @param {string} value
|
|
305
|
+
*/
|
|
306
|
+
listenLabel(name, value) {
|
|
307
|
+
if (name === "label" && this._inputContent) {
|
|
308
|
+
if (value != null) {
|
|
309
|
+
if (this._label) {
|
|
310
|
+
this._label.innerHTML = value;
|
|
311
|
+
} else {
|
|
312
|
+
this._label = document.createElement("label");
|
|
313
|
+
this._label.innerHTML = value;
|
|
314
|
+
this._label.setAttribute("class", "ran-input-label");
|
|
315
|
+
this._label.setAttribute("part", "ran-input-label");
|
|
316
|
+
this._input.appendChild(this._label);
|
|
317
|
+
}
|
|
318
|
+
} else {
|
|
319
|
+
this._input.removeAttribute("label");
|
|
320
|
+
if (this._label) {
|
|
321
|
+
this._input.removeChild(this._label);
|
|
322
|
+
this._label = void 0;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* @description: 监听type属性
|
|
329
|
+
* @param {string} name
|
|
330
|
+
* @param {string} value
|
|
331
|
+
*/
|
|
332
|
+
listenType(name, value) {
|
|
333
|
+
if (name === "type" && this._inputContent) {
|
|
334
|
+
if (value) {
|
|
335
|
+
this._inputContent.setAttribute("type", value);
|
|
336
|
+
} else {
|
|
337
|
+
this._inputContent.removeAttribute("type");
|
|
338
|
+
this._inputContent.removeAttribute("min");
|
|
339
|
+
this._inputContent.removeAttribute("max");
|
|
340
|
+
this._inputContent.removeAttribute("step");
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* @description: 监听status属性
|
|
346
|
+
* @param {string} name
|
|
347
|
+
* @param {string} value
|
|
348
|
+
*/
|
|
349
|
+
listenStatus(name, value) {
|
|
350
|
+
if (name === "status" && this._input) {
|
|
351
|
+
if (value) {
|
|
352
|
+
this._input.setAttribute("status", value);
|
|
353
|
+
} else {
|
|
354
|
+
this._input.removeAttribute("status");
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* @description: 监听disabled属性
|
|
360
|
+
* @param {string} name
|
|
361
|
+
* @param {string} value
|
|
362
|
+
*/
|
|
363
|
+
listenDisabled(name, value) {
|
|
364
|
+
if (name === "disabled" && this._input) {
|
|
365
|
+
if (falseList.includes(value)) {
|
|
366
|
+
this._input.removeAttribute("disabled");
|
|
367
|
+
} else {
|
|
368
|
+
this._input.setAttribute("disabled", "");
|
|
369
|
+
this._inputContent.setAttribute("disabled", "");
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* @description: 监听icon属性
|
|
375
|
+
* @param {string} name
|
|
376
|
+
* @param {string} value
|
|
377
|
+
*/
|
|
378
|
+
listenIcon(name, value, oldValue) {
|
|
379
|
+
if (name === "icon" && value && value !== oldValue) {
|
|
380
|
+
this.removeAttribute("label");
|
|
381
|
+
this.setAttribute("icon", value);
|
|
382
|
+
this.dealIcon();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* @description: 聚合监听事件
|
|
387
|
+
* @param {string} name
|
|
388
|
+
* @param {string} oldValue
|
|
389
|
+
* @param {string} newValue
|
|
390
|
+
*/
|
|
391
|
+
listenEvent(name, oldValue, newValue) {
|
|
392
|
+
this.listenPlaceholder(name, newValue);
|
|
393
|
+
this.listenLabel(name, newValue);
|
|
394
|
+
this.listenStatus(name, newValue);
|
|
395
|
+
this.listenDisabled(name, newValue);
|
|
396
|
+
this.listenIcon(name, newValue, oldValue);
|
|
397
|
+
}
|
|
398
|
+
connectedCallback() {
|
|
399
|
+
if (this.value) {
|
|
400
|
+
this._inputContent.value = this.value;
|
|
401
|
+
this._input.setAttribute("value", this.value);
|
|
402
|
+
}
|
|
403
|
+
if (this.status) {
|
|
404
|
+
this._input.setAttribute("status", this.status);
|
|
405
|
+
}
|
|
406
|
+
if (isDisabled(this)) {
|
|
407
|
+
this._input.setAttribute("disabled", "");
|
|
408
|
+
this._inputContent.setAttribute("disabled", "");
|
|
409
|
+
}
|
|
410
|
+
if (this.type) {
|
|
411
|
+
this._inputContent.setAttribute("type", this.type);
|
|
412
|
+
}
|
|
413
|
+
this._inputContent.addEventListener("input", this.customInput);
|
|
414
|
+
if (document.readyState === "complete") {
|
|
415
|
+
this.dealIcon();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
disconnectCallback() {
|
|
419
|
+
this._inputContent.removeEventListener("input", this.customInput);
|
|
420
|
+
}
|
|
421
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
422
|
+
this.listenEvent(name, oldValue, newValue);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
customElements.define("r-input", CustomElement);
|
|
426
|
+
return CustomElement;
|
|
427
|
+
} else {
|
|
428
|
+
return createCustomError("document is undefined or r-input is exist");
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
const index = Custom();
|
|
432
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
433
|
+
__proto__: null,
|
|
434
|
+
default: index
|
|
435
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
436
|
+
export {
|
|
437
|
+
index as a,
|
|
438
|
+
index$1 as i
|
|
439
|
+
};
|