ranui 0.1.9 → 0.1.10-alpha.10
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/README.zh-CN.md +190 -0
- package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +12 -0
- package/dist/arrow-down-B_hCY3Wt.js +662 -0
- package/dist/button.js +7 -0
- package/dist/checkbox.js +7 -0
- package/dist/colorpicker.js +11 -0
- package/dist/{colz-746223ab.js → colz-DJZvo_8B.js} +4 -13
- package/dist/docx-CHkPTdGU.js +3665 -0
- package/dist/drop-4j4abxje.js +36 -0
- package/dist/icon.js +6 -0
- package/dist/iconShadowless.js +6 -0
- package/dist/image.js +4 -0
- package/dist/{index-4443363f.js → index-15M0olqa.js} +40 -68
- package/dist/index-1v568_nq.js +140 -0
- package/dist/index-B897keW5.js +279 -0
- package/dist/{index-e03d23e7.js → index-BZR0HaP2.js} +2 -5
- package/dist/{index-e2e5d725.js → index-B_GuEcTd.js} +1280 -2146
- package/dist/index-Bc2Bcl8D.js +63701 -0
- package/dist/index-C4Sv0T51.js +495 -0
- package/dist/{index-2d16a084.js → index-C6RcMHoH.js} +12 -22
- package/dist/index-C9z10IgG.js +103 -0
- package/dist/{index-3cf72afd.js → index-CFjEuvBW.js} +23 -45
- package/dist/{index-7b8840f9.js → index-CGEx9VOA.js} +1086 -2670
- package/dist/index-CGYfjKUV.js +72 -0
- package/dist/index-CVtBLEpV.js +712 -0
- package/dist/index-CiWwvEMM.js +511 -0
- package/dist/index-CtVOgBDk.js +659 -0
- package/dist/index-D4qUro5V.js +279 -0
- package/dist/index-D4y9c1Dj.js +310 -0
- package/dist/{index-b7790662.js → index-DAxs7Dd2.js} +6 -13
- package/dist/index-DC5EA657.js +91 -0
- package/dist/index-DJZmDHz-.js +146 -0
- package/dist/{index-0d5b9435.js → index-D_CA5VDZ.js} +11 -15
- package/dist/{index-01b17e26.js → index-KS2nvVcO.js} +2 -5
- package/dist/{index-1048a998.js → index-WfFw4LJT.js} +105 -62
- package/dist/{index-458debf7.js → index-mhFL9MJp.js} +15 -49
- package/dist/index.d.ts +211 -14
- package/dist/index.js +24 -24
- 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-Dhs3nUkD.js +2346 -0
- package/dist/katex-es-B5r5vt3m.js +14628 -0
- package/dist/loading-scene-BMc2wqKm.js +4 -0
- package/dist/loading.js +8 -0
- package/dist/math.js +7 -0
- package/dist/message.js +6 -0
- package/dist/modal.js +4 -0
- package/dist/{pdf-bdb7818a.js → pdf-Cx0VWKFo.js} +13 -8
- package/dist/player.js +8 -0
- package/dist/popover.js +8 -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/{index-1b73beee.js → selectShadowless.js} +161 -165
- package/dist/shadowless.js +8 -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 +31 -0
- package/dist/typings.d.ts +211 -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/package.json +113 -69
- package/readme.md +38 -56
- package/typings.d.ts +211 -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/option/index.js +0 -95
- 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-57492b9b.js +0 -48
- package/dist/index-7216d6b0.js +0 -175
- package/dist/index-73ce455b.js +0 -264
- package/dist/index-7913ec46.js +0 -239
- package/dist/index-c14450a9.js +0 -662
- 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,495 @@
|
|
|
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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { H as HTMLElementSSR, i as isDisabled, f as falseList, c as createCustomError } from "./index-DC5EA657.js";
|
|
5
|
+
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:var(--ran-input-position, relative);display:var(--ran-input-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:var(--ran-input-icon-display, flex);align-items:var(--ran-input-icon-align-items, center);justify-content:var(--ran-input-icon-justify-content, center)}.ran-input:active{border-color:var(--ran-input-active-border-color, #40a9ff);box-shadow:var(--ran-input-active-box-shadow, 0 0 0 2px rgba(24, 144, 255, .2));border-right-width:var(--ran-input-active-border-right-width, 1px);outline:var(--ran-input-active-outline, 0)}.ran-input:hover{border-color:var(--ran-input-hover-border-color, #40a9ff);border-right-width:var(--ran-input-hover-border-right-width, 1px)}.ran-input>.ran-input-content:hover~.ran-input-label{color:var(--ran-input-label-hover-color, #40a9ff)}.ran-input[value]>.ran-input-label{transform:var(--ran-input-label-value-transform, translateY( calc(-50% - .43em) ) scale(.8));color:var(--ran-input-label-value-color, #00000040)}.ran-input[status=error]{border-color:var(--ran-input-status-error-border-color, #ff4d4f)}.ran-input[status=error]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-status-error-color, #ff4d4f)}.ran-input[status=warning]{border-color:var(--ran-input-status-warning-border-color, #ff7875)}.ran-input[status=warning]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-status-warning-color, #ff7875)}.ran-input[disabled]{color:var(--ran-input-disabled-color, #00000040);background-color:var(--ran-input-disabled-background-color, #f5f5f5);border-color:var(--ran-input-disabled-border-color, #d9d9d9);box-shadow:var(--ran-input-disabled-box-shadow, none);cursor:var(--ran-input-disabled-cursor, not-allowed);opacity:var(--ran-input-disabled-opacity, 1)}.ran-input[disabled]>.ran-input-content{color:var(--ran-input-content-disabled-color, #00000040);background-color:var(--ran-input-content-disabled-background-color, #f5f5f5);border-color:var(--ran-input-content-disabled-border-color, #d9d9d9);box-shadow:var(--ran-input-content-disabled-box-shadow, none);cursor:var(--ran-input-content-disabled-cursor, not-allowed);opacity:var(--ran-input-content-disabled-opacity, 1)}.ran-input[disabled]>.ran-input-content~.ran-input-label{color:var(--ran-input-label-disabled-color, #00000040);background-color:var(--ran-input-label-disabled-background-color, #f5f5f5)}.ran-input[disabled]>.ran-input-label{color:#999;border-color:var(--ran-input-label-disabled-border-color, #d9d9d9);box-shadow:var(--ran-input-label-disabled-box-shadow, none);cursor:var(--ran-input-label-disabled-cursor, not-allowed)}.ran-input-content{writing-mode:var(--ran-input-content-writing-mode, horizontal-tb);text-rendering:var(--ran-input-content-text-rendering, auto);letter-spacing:var(--ran-input-content-letter-spacing, normal);word-spacing:var(--ran-input-content-word-spacing, normal);text-transform:var(--ran-input-content-text-transform, none);text-indent:var(--ran-input-content-text-indent, 0px);text-shadow:var(--ran-input-content-text-shadow, none);text-align:var(--ran-input-content-text-align, start);cursor:var(--ran-input-content-cursor, text);touch-action:var(--ran-input-content-touch-action, manipulation);-webkit-appearance:var(--ran-input-content--webkit-appearance, none);text-overflow:var(--ran-input-content-text-overflow, ellipsis);box-sizing:var(--ran-input-content-box-sizing, border-box);margin:var(--ran-input-content-margin, 0);font-variant:var(--ran-input-content-font-variant, tabular-nums);list-style:var(--ran-input-content-list-style, none);font-feature-settings:var(--ran-input-content-font-feature-settings, "tnum");position:var(--ran-input-content-position, relative);border:var(--ran-input-content-border, none);width:var(--ran-input-content-width, 100%);min-width:var(--ran-input-content-min-width, 0);color:var(--ran-input-content-color, #000000d9);font-size:var(--ran-input-content-font-size, 14px);line-height:var(--ran-input-content-line-height, 1.48);background-color:var(--ran-input-content-background-color, #fff);background-image:var(--ran-input-content-background-image, none);transition:var(--ran-input-content-transition, all .3s);outline:var(--ran-input-content-outline, none)}.ran-input-content:focus,.ran-input-content:hover{border:var(--ran-input-content-hover-border, none);outline:var(--ran-input-content-hover-outline, 0)}.ran-input-content::placeholder{color:var(--ran-input-content-placeholder-color, #999)}.ran-input-content:placeholder-shown~.ran-input-label{transform:var(--ran-input-content-placeholder-label-transform, translateY( calc(-50% - .43em) ) scale(.8))}.ran-input-content:focus~.ran-input-label{transform:var(--ran-input-content-focus-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:var(--ran-input-label-pointer-events, none);position:var(--ran-input-label-position, absolute);font-size:var(--ran-input-label-font-size, 14px);left:var(--ran-input-label-left, 8px);transition:var(--ran-input-label-transition, transform .3s, color .3s, background-color .3s, backdrop-filter .3s);transform-origin:var(--ran-input-label-transform-origin, left);padding:var(--ran-input-label-padding, 0 .2em);color:var(--ran-input-label-color, #999);background:var(--ran-input-label-background, #fff);opacity:var(--ran-input-label-opacity, .9)}';
|
|
6
|
+
class Input extends HTMLElementSSR() {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
__publicField(this, "_input");
|
|
10
|
+
__publicField(this, "_label");
|
|
11
|
+
__publicField(this, "_inputContent");
|
|
12
|
+
__publicField(this, "_icon");
|
|
13
|
+
/**
|
|
14
|
+
* @description: 原生的 input 方法
|
|
15
|
+
* @param {Event} event
|
|
16
|
+
*/
|
|
17
|
+
__publicField(this, "customInput", (event) => {
|
|
18
|
+
event.stopPropagation();
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
const { target, data = "" } = event;
|
|
21
|
+
this.value = (target == null ? void 0 : target.value) || data || "";
|
|
22
|
+
this.customChange();
|
|
23
|
+
this.dispatchEvent(
|
|
24
|
+
new CustomEvent("input", {
|
|
25
|
+
detail: {
|
|
26
|
+
value: this.value
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* @description: 增加 change 方法,同时兼容大小写的情况
|
|
33
|
+
*/
|
|
34
|
+
__publicField(this, "customChange", () => {
|
|
35
|
+
this.dispatchEvent(
|
|
36
|
+
new CustomEvent("change", {
|
|
37
|
+
detail: {
|
|
38
|
+
value: this.value
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* @description: 监听 placeholder 属性函数
|
|
45
|
+
* @param {string} name
|
|
46
|
+
* @param {string} value
|
|
47
|
+
*/
|
|
48
|
+
__publicField(this, "listenPlaceholder", (name, value) => {
|
|
49
|
+
if (name === "placeholder" && this._inputContent) {
|
|
50
|
+
if (value != null) {
|
|
51
|
+
this._inputContent.setAttribute("placeholder", value);
|
|
52
|
+
} else {
|
|
53
|
+
this._inputContent.removeAttribute("placeholder");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* @description: 监听 label 属性函数
|
|
59
|
+
* @param {string} name
|
|
60
|
+
* @param {string} value
|
|
61
|
+
*/
|
|
62
|
+
__publicField(this, "listenLabel", (name, value) => {
|
|
63
|
+
if (name === "label" && this._inputContent) {
|
|
64
|
+
if (value != null) {
|
|
65
|
+
if (this._label) {
|
|
66
|
+
this._label.innerHTML = value;
|
|
67
|
+
} else {
|
|
68
|
+
this._label = document.createElement("label");
|
|
69
|
+
this._label.innerHTML = value;
|
|
70
|
+
this._label.setAttribute("class", "ran-input-label");
|
|
71
|
+
this._label.setAttribute("part", "ran-input-label");
|
|
72
|
+
this._input.appendChild(this._label);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
this._input.removeAttribute("label");
|
|
76
|
+
if (this._label) {
|
|
77
|
+
this._input.removeChild(this._label);
|
|
78
|
+
this._label = void 0;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* @description: 监听 type 属性
|
|
85
|
+
* @param {string} name
|
|
86
|
+
* @param {string} value
|
|
87
|
+
*/
|
|
88
|
+
__publicField(this, "listenType", (name, value) => {
|
|
89
|
+
if (name === "type" && this._inputContent) {
|
|
90
|
+
if (value) {
|
|
91
|
+
this._inputContent.setAttribute("type", value);
|
|
92
|
+
} else {
|
|
93
|
+
this._inputContent.removeAttribute("type");
|
|
94
|
+
this._inputContent.removeAttribute("min");
|
|
95
|
+
this._inputContent.removeAttribute("max");
|
|
96
|
+
this._inputContent.removeAttribute("step");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* @description: 监听 status 属性
|
|
102
|
+
* @param {string} name
|
|
103
|
+
* @param {string} value
|
|
104
|
+
*/
|
|
105
|
+
__publicField(this, "listenStatus", (name, value) => {
|
|
106
|
+
if (name === "status" && this._input) {
|
|
107
|
+
if (value) {
|
|
108
|
+
this._input.setAttribute("status", value);
|
|
109
|
+
} else {
|
|
110
|
+
this._input.removeAttribute("status");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* @description: 监听 disabled 属性
|
|
116
|
+
* @param {string} name
|
|
117
|
+
* @param {string} value
|
|
118
|
+
*/
|
|
119
|
+
__publicField(this, "listenDisabled", (name, value) => {
|
|
120
|
+
if (name === "disabled" && this._input) {
|
|
121
|
+
if (falseList.includes(value)) {
|
|
122
|
+
this._input.removeAttribute("disabled");
|
|
123
|
+
} else {
|
|
124
|
+
this._input.setAttribute("disabled", "");
|
|
125
|
+
this._inputContent.setAttribute("disabled", "");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* @description: 监听 icon 属性
|
|
131
|
+
* @param {string} name
|
|
132
|
+
* @param {string} value
|
|
133
|
+
*/
|
|
134
|
+
__publicField(this, "listenIcon", (name, value, oldValue) => {
|
|
135
|
+
if (name === "icon" && value && value !== oldValue) {
|
|
136
|
+
this.removeAttribute("label");
|
|
137
|
+
this.setAttribute("icon", value);
|
|
138
|
+
this.dealIcon();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* @description: 处理 icon 属性的问题
|
|
143
|
+
*/
|
|
144
|
+
__publicField(this, "dealIcon", () => {
|
|
145
|
+
if (!this._icon) {
|
|
146
|
+
this._icon = document.createElement("ra-icon");
|
|
147
|
+
const { width, height } = this._inputContent.getBoundingClientRect();
|
|
148
|
+
const size = Math.min(width, height);
|
|
149
|
+
this._icon.setAttribute("size", `${size}`);
|
|
150
|
+
this._inputContent.insertAdjacentElement("beforebegin", this._icon);
|
|
151
|
+
}
|
|
152
|
+
this.icon && this._icon.setAttribute("name", this.icon);
|
|
153
|
+
});
|
|
154
|
+
/**
|
|
155
|
+
* @description: 聚合监听事件
|
|
156
|
+
* @param {string} name
|
|
157
|
+
* @param {string} oldValue
|
|
158
|
+
* @param {string} newValue
|
|
159
|
+
*/
|
|
160
|
+
__publicField(this, "listenEvent", (name, oldValue, newValue) => {
|
|
161
|
+
this.listenPlaceholder(name, newValue);
|
|
162
|
+
this.listenLabel(name, newValue);
|
|
163
|
+
this.listenStatus(name, newValue);
|
|
164
|
+
this.listenDisabled(name, newValue);
|
|
165
|
+
this.listenIcon(name, newValue, oldValue);
|
|
166
|
+
if (name === "value" && oldValue !== newValue) {
|
|
167
|
+
this._inputContent.value = newValue;
|
|
168
|
+
this._input.setAttribute("value", newValue);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
172
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
173
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
174
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
175
|
+
this._input = document.createElement("div");
|
|
176
|
+
this._input.setAttribute("class", "ran-input");
|
|
177
|
+
this._input.setAttribute("part", "ran-input");
|
|
178
|
+
this._inputContent = document.createElement("input");
|
|
179
|
+
this._inputContent.setAttribute("class", "ran-input-content");
|
|
180
|
+
this._inputContent.setAttribute("part", "ran-input-content");
|
|
181
|
+
this._input.appendChild(this._inputContent);
|
|
182
|
+
shadowRoot.appendChild(this._input);
|
|
183
|
+
}
|
|
184
|
+
static get observedAttributes() {
|
|
185
|
+
return [
|
|
186
|
+
"label",
|
|
187
|
+
"disabled",
|
|
188
|
+
"name",
|
|
189
|
+
"placeholder",
|
|
190
|
+
"type",
|
|
191
|
+
"icon",
|
|
192
|
+
"value",
|
|
193
|
+
"status",
|
|
194
|
+
// error warning normal
|
|
195
|
+
"prefix",
|
|
196
|
+
// 前缀
|
|
197
|
+
"suffix",
|
|
198
|
+
// 后缀
|
|
199
|
+
"allowclear",
|
|
200
|
+
// 清除 icon
|
|
201
|
+
"count",
|
|
202
|
+
// 计算输入的数量
|
|
203
|
+
"maxlength",
|
|
204
|
+
"showcount",
|
|
205
|
+
"onPressEnter",
|
|
206
|
+
// 按下回车的回调
|
|
207
|
+
"variant",
|
|
208
|
+
// filled borderless
|
|
209
|
+
"minrows",
|
|
210
|
+
// 当 type 等于 TextArea 时
|
|
211
|
+
"maxrows"
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @description: 获取 input 的值
|
|
216
|
+
* @return {String}
|
|
217
|
+
*/
|
|
218
|
+
get value() {
|
|
219
|
+
return this.getAttribute("value") || "";
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* @description: 设置 input 的值
|
|
223
|
+
* @param {String} value
|
|
224
|
+
*/
|
|
225
|
+
set value(value) {
|
|
226
|
+
if (!isDisabled(this) && value) {
|
|
227
|
+
this.setAttribute("value", value);
|
|
228
|
+
this._input.setAttribute("value", value);
|
|
229
|
+
} else {
|
|
230
|
+
this.removeAttribute("value");
|
|
231
|
+
this._input.removeAttribute("value");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @description: 获取 input 的占位字符
|
|
236
|
+
* @return {String}
|
|
237
|
+
*/
|
|
238
|
+
get placeholder() {
|
|
239
|
+
return this.getAttribute("placeholder") || "";
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* @description: 设置 input 的占位字符
|
|
243
|
+
* @param {String} value
|
|
244
|
+
*/
|
|
245
|
+
set placeholder(value) {
|
|
246
|
+
if (value) {
|
|
247
|
+
this.setAttribute("placeholder", value);
|
|
248
|
+
} else {
|
|
249
|
+
this.removeAttribute("placeholder");
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @description: input 是否为必选
|
|
254
|
+
* @return {String}
|
|
255
|
+
*/
|
|
256
|
+
get required() {
|
|
257
|
+
return this.getAttribute("required") || "";
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @description: 设置 input 是否为必选,除非设置成 false,否则都是必填
|
|
261
|
+
* @param {*} value
|
|
262
|
+
*/
|
|
263
|
+
set required(value) {
|
|
264
|
+
if (!value || value === "false") {
|
|
265
|
+
this.removeAttribute("required");
|
|
266
|
+
} else {
|
|
267
|
+
this.setAttribute("required", "");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @description: 获取 input 上 disabled 属性
|
|
272
|
+
* @return {String | null}
|
|
273
|
+
*/
|
|
274
|
+
get disabled() {
|
|
275
|
+
return `${isDisabled(this)}`;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* @description: 设置 input 的 disabled 属性
|
|
279
|
+
* @param {String} value
|
|
280
|
+
*/
|
|
281
|
+
set disabled(value) {
|
|
282
|
+
if (falseList.includes(value)) {
|
|
283
|
+
this.removeAttribute("disabled");
|
|
284
|
+
this._input.removeAttribute("disabled");
|
|
285
|
+
this._inputContent.removeAttribute("disabled");
|
|
286
|
+
} else {
|
|
287
|
+
this.setAttribute("disabled", "");
|
|
288
|
+
this._input.setAttribute("disabled", "");
|
|
289
|
+
this._inputContent.setAttribute("disabled", "");
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* @description: 获取类似于 Metiral Design 的输入体验。
|
|
294
|
+
*/
|
|
295
|
+
get label() {
|
|
296
|
+
return this.getAttribute("label") || "";
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* @description: 设置类似于 Metiral Design 的输入体验。
|
|
300
|
+
*/
|
|
301
|
+
set label(value) {
|
|
302
|
+
this.setAttribute("label", value);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* @description: 获取 input 框的状态
|
|
306
|
+
*/
|
|
307
|
+
get status() {
|
|
308
|
+
return this.getAttribute("status") || "";
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* @description: 设置 input 框的状态
|
|
312
|
+
*/
|
|
313
|
+
set status(value) {
|
|
314
|
+
if (value) {
|
|
315
|
+
this.setAttribute("status", value);
|
|
316
|
+
this._input.setAttribute("status", value);
|
|
317
|
+
} else {
|
|
318
|
+
this.removeAttribute("status");
|
|
319
|
+
this._input.removeAttribute("status");
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* @description: 与 form 组件联动时,收集的属性名
|
|
324
|
+
* @return {String}
|
|
325
|
+
*/
|
|
326
|
+
get name() {
|
|
327
|
+
return this.getAttribute("name") || "";
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* @description: 设置 name 属性
|
|
331
|
+
* @param {string} value
|
|
332
|
+
*/
|
|
333
|
+
set name(value) {
|
|
334
|
+
this.setAttribute("name", value);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* @description: 当 input 类型为 number 类型时,可以获取 min 属性
|
|
338
|
+
* @return {String}
|
|
339
|
+
*/
|
|
340
|
+
get min() {
|
|
341
|
+
return this.getAttribute("min") || "";
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* @description: 当 input 类型为 number 类型时,设置 min 属性
|
|
345
|
+
* @param {string} value
|
|
346
|
+
*/
|
|
347
|
+
set min(value) {
|
|
348
|
+
if (this.type === "number") this.setAttribute("min", value);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* @description: 当 input 类型为 number 类型时,可以获取 max 属性
|
|
352
|
+
* @return {String}
|
|
353
|
+
*/
|
|
354
|
+
get max() {
|
|
355
|
+
return this.getAttribute("max") || "";
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* @description: 当 input 类型为 number 类型时,设置 max 属性
|
|
359
|
+
* @param {string} value
|
|
360
|
+
*/
|
|
361
|
+
set max(value) {
|
|
362
|
+
if (this.type === "number") this.setAttribute("max", value);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* @description: 当 input 类型为 number 类型时,可以获取 step 属性
|
|
366
|
+
* @return {String}
|
|
367
|
+
*/
|
|
368
|
+
get step() {
|
|
369
|
+
return this.getAttribute("step") || "";
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* @description: 当 input 类型为 number 类型时,设置 step 属性
|
|
373
|
+
* @param {string} value
|
|
374
|
+
*/
|
|
375
|
+
set step(value) {
|
|
376
|
+
if (this.type === "number") 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
|
+
}
|
|
470
|
+
disconnectCallback() {
|
|
471
|
+
this._inputContent.removeEventListener("input", this.customInput);
|
|
472
|
+
}
|
|
473
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
474
|
+
this.listenEvent(name, oldValue, newValue);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function Custom() {
|
|
478
|
+
if (typeof window !== "undefined" && !customElements.get("r-input")) {
|
|
479
|
+
customElements.define("r-input", Input);
|
|
480
|
+
return Input;
|
|
481
|
+
} else {
|
|
482
|
+
return createCustomError("document is undefined or r-input is exist");
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
const index = Custom();
|
|
486
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
487
|
+
__proto__: null,
|
|
488
|
+
Input,
|
|
489
|
+
default: index
|
|
490
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
491
|
+
export {
|
|
492
|
+
Input as I,
|
|
493
|
+
index as a,
|
|
494
|
+
index$1 as i
|
|
495
|
+
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
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
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
import { i as isDisabled, f as falseList, c as createCustomError } from "./index-57492b9b.js";
|
|
9
|
-
const f7170ee498e0dd32cbdcb63fba8f75cc = '.remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{position:relative;display:inline-block;background-image:none;box-shadow:0 2px #00000004;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;touch-action:manipulation;overflow:hidden;pointer-events:auto}:host .ran-btn{position:relative;display:inline-block;background-image:none;cursor:pointer;transition:all .3s cubic-bezier(.645,.045,.355,1);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;touch-action:manipulation;background:#fff}:host,:host(:active),:host(:focus){outline:0;-webkit-tap-highlight-color:transparent}:host .ran-btn,:host(:active) .ran-btn,:host(:focus) .ran-btn{outline:0}:host(:not([disabled]):hover) .ran-btn-content{border-color:#1890ff;color:#1890ff}:host([type="primary"]) .ran-btn-content{border-color:#1890ff;background-color:#1890ff;color:#fff}:host([type="primary"]:not([disabled])) .ran-btn:after{background-image:radial-gradient(circle,#fff 10%,transparent 10.01%)}:host([type="primary"]:not([disabled]):hover) .ran-btn-content{background-color:#40a9ff;color:#fff}:host([type="warning"]) .ran-btn-content{border-color:#ff4d4f;background-color:#ff4d4f;color:#fff}:host([type="warning"]:not([disabled])) .ran-btn:after{background-image:radial-gradient(circle,#fff 10%,transparent 10.01%)}:host([type="warning"]:not([disabled]):hover) .ran-btn-content{border-color:#ff4d4f;background-color:#ff4d4f;color:#fff}:host([type="text"]) .ran-btn-content{border:none}:host([disabled]){cursor:not-allowed;pointer-events:all;opacity:.6}:host([disabled]) .ran-btn{cursor:not-allowed;pointer-events:all;opacity:.6}:host(:not([disabled]):active) .ran-btn:after{transform:translate(-50%,-50%) scale(0);opacity:.3;transition:0s}@media (min-width: 1024px){:host(:not([disabled],[effect])) .ran-btn:after{content:"";display:block;position:absolute;width:100%;height:100%;left:var(--ran-x, 0);top:var(--ran-y, 0);pointer-events:none;background-image:radial-gradient(circle,#1890ff 10%,transparent 10.01%);background-repeat:no-repeat;background-position:50%;transform:translate(-50%,-50%) scale(10);opacity:0;transition:transform .3s,opacity .8s}}:host .slot{display:block}.ran-btn-content{display:flex;justify-content:space-between;align-items:center;padding:4px 15px;border:1px solid transparent;border-radius:2px;border-color:#d9d9d9;color:#000000d9;line-height:22px;font-size:14px;font-weight:400;white-space:nowrap;text-align:center}.ran-btn-content .icon{margin-right:2px}\n';
|
|
10
|
-
class Button extends HTMLElement {
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { b as currentDevice } from "./arrow-down-B_hCY3Wt.js";
|
|
5
|
+
import { H as HTMLElementSSR, i as isDisabled, f as falseList, c as createCustomError } from "./index-DC5EA657.js";
|
|
6
|
+
const f7170ee498e0dd32cbdcb63fba8f75cc = '.remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{position:var(--ran-btn-position, relative);display:var(--ran-btn-display, inline-block);background-image:var(--ran-btn-background-image, none);box-shadow:var(--ran-btn-box-shadow, 0 2px #00000004);cursor:var(--ran-btn-cursor, pointer);-webkit-user-select:var(--ran-btn-user-select, none);user-select:var(--ran-btn-user-select, none);touch-action:var(--ran-btn-touch-action, manipulation);overflow:var(--ran-btn-overflow, hidden);pointer-events:var(--ran-btn-pointer-events, auto)}:host .ran-btn{position:var(--ran-btn-contain-position, relative);display:var(--ran-btn-contain-display, inline-block);background-image:var(--ran-btn-contain-background-image, none);cursor:var(--ran-btn-contain-cursor, pointer);transition:var(--ran-btn-contain-transition, all .3s cubic-bezier(.645, .045, .355, 1));-webkit-user-select:var(--ran-btn-contain-user-select, none);user-select:var(--ran-btn-contain-user-select, none);touch-action:var(--ran-btn-contain-touch-action, manipulation);background:var(--ran-btn-contain-background, #fff)}:host,:host(:active),:host(:focus){outline:0;-webkit-tap-highlight-color:transparent}:host .ran-btn,:host(:active) .ran-btn,:host(:focus) .ran-btn{outline:var(--ran-btn-contain-outline, 0)}:host([type="primary"]) .ran-btn-content{background-color:var(--ran-btn-content-background-color, #1890ff);border-color:var(--ran-btn-content-border-color, #1890ff);color:var(--ran-btn-content-color, #fff)}:host([type="primary"]:not([disabled])) .ran-btn:after{background-image:var(--ran-btn-after-background-image, radial-gradient(circle, #fff 10%, transparent 10.01%))}@media (min-width: 1024px){:host(:not([disabled]):hover) .ran-btn-content{border-color:var(--ran-btn-content-hover-border-color, #1890ff);color:var(--ran-btn-content-hover-color, #1890ff)}:host([type="primary"]:not([disabled]):hover) .ran-btn-content{background-color:var(--ran-btn-content-hover-background-color, #40a9ff);color:var(--ran-btn-content-hover-color, #fff)}:host([type="warning"]:not([disabled]):hover) .ran-btn-content{border-color:var(--ran-btn-content-warning-border-color, #ff4d4f);background-color:var(--ran-btn-content-warning-background-color, #ff4d4f);color:var(--ran-btn-content-warning-color, #fff)}}:host([type="warning"]) .ran-btn-content{border-color:var(--ran-btn-content-warning-border-color, #ff4d4f);background-color:var(--ran-btn-content-warning-background-color, #ff4d4f);color:var(--ran-btn-content-warning-color, #fff)}:host([type="warning"]:not([disabled])) .ran-btn:after{background-image:var(--ran-btn-after-background-image, radial-gradient(circle, #fff 10%, transparent 10.01%))}:host([type="text"]) .ran-btn-content{border:var(--ran-btn-content-text-border, none)}:host([disabled]){cursor:var(--ran-btn-disabled-cursor, not-allowed);pointer-events:var(--ran-btn-disabled-pointer-events, all);opacity:var(--ran-btn-disabled-opacity, .6)}:host([disabled]) .ran-btn{cursor:var(--ran-btn-disabled-container-cursor, not-allowed);pointer-events:var(--ran-btn-disabled-container-pointer-events, all);opacity:var(--ran-btn-disabled-container-opacity, .6)}:host(:not([disabled]):active) .ran-btn:after{transform:var(--ran-btn-after-transform, translate(-50%, -50%) scale(0));opacity:var(--ran-btn-after-opacity, .3);transition:var(--ran-btn-after-transition, 0s)}@media (min-width: 1024px){:host(:not([disabled],[effect])) .ran-btn:after{content:"";display:block;position:absolute;width:100%;height:100%;left:var(--ran-x, 0);top:var(--ran-y, 0);pointer-events:none;background-image:radial-gradient(circle,#1890ff 10%,transparent 10.01%);background-repeat:no-repeat;background-position:50%;transform:translate(-50%,-50%) scale(10);opacity:0;transition:transform .3s,opacity .8s}}:host .slot{display:var(--ran-btn-slot-display, block)}.ran-btn-content{display:var(--ran-btn-content-display, flex);justify-content:var(--ran-btn-content-display, space-between);align-items:var(--ran-btn-content-align-items, center);padding:var(--ran-btn-content-padding, 4px 15px);border:var(--ran-btn-content-border, 1px solid transparent);border-radius:var(--ran-btn-content-border-radius, 2px);border-color:var(--ran-btn-content-border-color, #d9d9d9);color:var(--ran-btn-content-color, #000000d9);line-height:var(--ran-btn-content-line-height, 22px);font-size:var(--ran-btn-content-font-size, 14px);font-weight:var(--ran-btn-content-font-weight, 400);white-space:var(--ran-btn-content-white-space, nowrap);text-align:var(--ran-btn-content-text-align, center)}.ran-btn-content .icon{margin-right:var(--ran-btn-icon-margin-right, 2px)}';
|
|
7
|
+
class Button extends HTMLElementSSR() {
|
|
11
8
|
constructor() {
|
|
12
9
|
super();
|
|
13
10
|
__publicField(this, "_btn");
|
|
@@ -17,7 +14,7 @@ class Button extends HTMLElement {
|
|
|
17
14
|
__publicField(this, "_shadowDom");
|
|
18
15
|
__publicField(this, "debounceTimeId");
|
|
19
16
|
/**
|
|
20
|
-
* @description: 设置button的icon
|
|
17
|
+
* @description: 设置 button 的 icon
|
|
21
18
|
* @return {*}
|
|
22
19
|
*/
|
|
23
20
|
__publicField(this, "setIcon", () => {
|
|
@@ -41,8 +38,7 @@ class Button extends HTMLElement {
|
|
|
41
38
|
}
|
|
42
39
|
});
|
|
43
40
|
__publicField(this, "mousedown", (event) => {
|
|
44
|
-
if (
|
|
45
|
-
return;
|
|
41
|
+
if (currentDevice() !== "pc") return;
|
|
46
42
|
if (!this.disabled || this.disabled === "false") {
|
|
47
43
|
this.debounceMouseEvent();
|
|
48
44
|
const { left, top } = this.getBoundingClientRect();
|
|
@@ -51,10 +47,8 @@ class Button extends HTMLElement {
|
|
|
51
47
|
}
|
|
52
48
|
});
|
|
53
49
|
__publicField(this, "mouseup", (event) => {
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
if (this.debounceTimeId)
|
|
57
|
-
return;
|
|
50
|
+
if (currentDevice() !== "pc") return;
|
|
51
|
+
if (this.debounceTimeId) return;
|
|
58
52
|
this.debounceTimeId = setTimeout(() => {
|
|
59
53
|
this._btn.style.removeProperty("--ran-x");
|
|
60
54
|
this._btn.style.removeProperty("--ran-y");
|
|
@@ -72,9 +66,7 @@ class Button extends HTMLElement {
|
|
|
72
66
|
sheet.insertRule(this.sheet);
|
|
73
67
|
this._shadowDom.adoptedStyleSheets = [sheet];
|
|
74
68
|
} catch (error) {
|
|
75
|
-
console.error(
|
|
76
|
-
`Failed to parse the rule in CSSStyleSheet: ${this.sheet}`
|
|
77
|
-
);
|
|
69
|
+
console.error(`Failed to parse the rule in CSSStyleSheet: ${this.sheet}`);
|
|
78
70
|
}
|
|
79
71
|
}
|
|
80
72
|
});
|
|
@@ -168,12 +160,10 @@ class Button extends HTMLElement {
|
|
|
168
160
|
this._btnContent.removeAttribute("disabled");
|
|
169
161
|
}
|
|
170
162
|
}
|
|
171
|
-
if (name === "icon" && this._btnContent && oldValue !== newValue)
|
|
172
|
-
this.setIcon();
|
|
163
|
+
if (name === "icon" && this._btnContent && oldValue !== newValue) this.setIcon();
|
|
173
164
|
if (name === "iconSize" && this._btnContent && oldValue !== newValue)
|
|
174
165
|
this._btnContent.setAttribute("iconSize", newValue);
|
|
175
|
-
if (name === "sheet" && this._shadowDom && oldValue !== newValue)
|
|
176
|
-
this.handlerExternalCss();
|
|
166
|
+
if (name === "sheet" && this._shadowDom && oldValue !== newValue) this.handlerExternalCss();
|
|
177
167
|
}
|
|
178
168
|
}
|
|
179
169
|
function Custom() {
|