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,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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { c as create, a as addClassToElement, r as removeClassToElement } from "./arrow-down-B_hCY3Wt.js";
|
|
5
|
+
import { c as createCustomError, H as HTMLElementSSR } 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}@keyframes ranui-dropdown-down-in{0%{transform:scaleY(.8);transform-origin:100% 100%;opacity:0}to{transform:scaleY(1);transform-origin:100% 100%;opacity:1}}@keyframes ranui-dropdown-down-out{0%{transform:scaleY(1);transform-origin:100% 100%;opacity:1}to{transform:scaleY(.8);transform-origin:100% 100%;opacity:0}}@keyframes ranui-dropdown-up-in{0%{transform:scaleY(.8);transform-origin:0% 0%;opacity:0}to{transform:scaleY(1);transform-origin:0% 0%;opacity:1}}@keyframes ranui-dropdown-up-out{0%{transform:scaleY(1);transform-origin:0% 0%;opacity:1}to{transform:scaleY(.8);transform-origin:0% 0%;opacity:0}}.ran-dropdown-down-in{animation:ranui-dropdown-up-in .2s;animation-fill-mode:forwards}.ran-dropdown-down-out{animation:ranui-dropdown-up-out .2s;animation-fill-mode:forwards}.ran-dropdown-up-in{animation:ranui-dropdown-down-in .2s;animation-fill-mode:forwards}.ran-dropdown-up-out{animation:ranui-dropdown-down-out .2s;animation-fill-mode:forwards}:host{text-align:var(--ran-dropdown-host-text-align, left);z-index:10}.ranui-dropdown{transform-origin:var(--ran-x, 50%) var(--ran-y, 50%);box-sizing:var(--ran-dropdown-box-sizing, border-box);margin:var(--ran-dropdown-margin, 0);padding:var(--ran-dropdown-padding, 4px);color:var(--ran-dropdown-color, rgba(0, 0, 0, .88));font-size:var(--ran-dropdown-font-size, 14px);list-style:var(--ran-dropdown-list-style, none);font-family:var(--ran-dropdown-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");z-index:var(--ran-dropdown-z-index, 1050);overflow:var(--ran-dropdown-overflow, hidden);font-variant:var(--ran-dropdown-font-variant, initial);background:var(--ran-dropdown-background, #ffffff);border-radius:var(--ran-dropdown-border-radius, 8px);outline:var(--ran-dropdown-outline, none);box-shadow:var(--ran-dropdown-box-shadow, 0 6px 16px 0 rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05));cursor:var(--ran-dropdown-cursor, pointer);width:var(--ran-dropdown-width, 100%)}.ranui-dropdown-container{position:var(--ran-dropdown-container-position, relative);display:var(--ran-dropdown-container-display, inline-block);width:var(--ran-dropdown-container-width, 100%);min-width:var(--ran-popover-width)}.ranui-dropdown-container .top{transform:translate(calc(var(--ran-popover-width) / 2 - 8px)) translateY(-16px) rotate(0);top:0}.ranui-dropdown-container .bottom{transform:translate(calc(var(--ran-popover-width) / 2 - 8px)) translateY(0) rotate(180deg);top:calc(var(--ran-popover-height) - 4px,0px)}.ranui-dropdown-arrow{position:var(--ran-dropdown-arrow-position, absolute);z-index:var(--ran-dropdown-arrow-z-index, 1);display:var(--ran-dropdown-arrow-display, block);pointer-events:var(--ran-dropdown-arrow-pointer-events, none);width:var(--ran-dropdown-arrow-width, 16px);height:var(--ran-dropdown-arrow-height, 16px);overflow:var(--ran-dropdown-arrow-overflow, hidden)}.ranui-dropdown-arrow:before{background:var(--ran-dropdown-arrow-before-background, #fff);position:var(--ran-dropdown-arrow-before-position, absolute);bottom:var(--ran-dropdown-arrow-before-bottom, 0);inset-inline-start:0;width:var(--ran-dropdown-arrow-before-width, 16px);height:var(--ran-dropdown-arrow-before-height, 8px );clip-path:path("M 0 8 A 4 4 0 0 0 2.82842712474619 6.82842712474619 L 6.585786437626905 3.0710678118654755 A 2 2 0 0 1 9.414213562373096 3.0710678118654755 L 13.17157287525381 6.82842712474619 A 4 4 0 0 0 16 8 Z");content:var(--ran-dropdown-arrow-before-content, "")}.ranui-dropdown-arrow:after{content:var(--ran-dropdown-arrow-after-content, "");position:var(--ran-dropdown-arrow-after-position, absolute);width:var(--ran-dropdown-arrow-after-width, 9px);height:var(--ran-dropdown-arrow-after-height, 9px);bottom:var(--ran-dropdown-arrow-after-bottom, 0);inset-inline:0;margin:var(--ran-dropdown-arrow-after-margin, auto);border-radius:var(--ran-dropdown-arrow-after-border-radius, 0 0 2px 0);transform:var(--ran-dropdown-arrow-after-transform, translateY(50%) rotate(-135deg));box-shadow:var(--ran-dropdown-arrow-after-box-shadow, 2px 2px 5px rgba(0, 0, 0, .05));z-index:var(--ran-dropdown-arrow-after-z-index, 0);background:var(--ran-dropdown-arrow-after-background, transparent)}';
|
|
7
|
+
const animationTime = 300;
|
|
8
|
+
class Dropdown extends HTMLElementSSR() {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
__publicField(this, "dropdown");
|
|
12
|
+
__publicField(this, "_slot");
|
|
13
|
+
__publicField(this, "_shadowDom");
|
|
14
|
+
__publicField(this, "arrowIcon");
|
|
15
|
+
__publicField(this, "container");
|
|
16
|
+
__publicField(this, "handlerTransit", () => {
|
|
17
|
+
if (this.transit) {
|
|
18
|
+
addClassToElement(this.dropdown.element, this.transit);
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
removeClassToElement(this.dropdown.element, this.transit);
|
|
21
|
+
}, animationTime);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
__publicField(this, "handlerArrow", () => {
|
|
25
|
+
if (!this.arrow) return;
|
|
26
|
+
if (!this.arrowIcon) {
|
|
27
|
+
this.arrowIcon = create("div").setAttribute("class", `ranui-dropdown-arrow ${this.arrow}`);
|
|
28
|
+
this.container.addChild([this.arrowIcon]);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
__publicField(this, "stopPropagation", (e) => {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
});
|
|
34
|
+
this._slot = create("slot").setAttribute("class", "slot");
|
|
35
|
+
this.dropdown = create("div").setStyle("-webkit-tap-highlight-color", "transparent").setStyle("outline", "0").setAttribute("class", "ranui-dropdown").setAttribute("part", "ranui-dropdown").addChild([this._slot]);
|
|
36
|
+
this.container = create("div").setAttribute("class", "ranui-dropdown-container").addChild([this.dropdown]);
|
|
37
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
38
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
39
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
40
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
41
|
+
this._shadowDom = shadowRoot;
|
|
42
|
+
shadowRoot.appendChild(this.container.element);
|
|
43
|
+
}
|
|
44
|
+
static get observedAttributes() {
|
|
45
|
+
return ["transit", "arrow"];
|
|
46
|
+
}
|
|
47
|
+
get transit() {
|
|
48
|
+
return this.getAttribute("transit") || "";
|
|
49
|
+
}
|
|
50
|
+
set transit(value) {
|
|
51
|
+
if (value) {
|
|
52
|
+
this.setAttribute("transit", value);
|
|
53
|
+
} else {
|
|
54
|
+
this.removeAttribute("transit");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
get arrow() {
|
|
58
|
+
return this.getAttribute("arrow") || "";
|
|
59
|
+
}
|
|
60
|
+
set arrow(value) {
|
|
61
|
+
if (value) {
|
|
62
|
+
this.setAttribute("arrow", value);
|
|
63
|
+
} else {
|
|
64
|
+
this.removeAttribute("arrow");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
get show() {
|
|
68
|
+
return this.getAttribute("show") || "";
|
|
69
|
+
}
|
|
70
|
+
set show(value) {
|
|
71
|
+
if (value) {
|
|
72
|
+
this.setAttribute("show", value);
|
|
73
|
+
} else {
|
|
74
|
+
this.removeAttribute("show");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
connectedCallback() {
|
|
78
|
+
this.handlerTransit();
|
|
79
|
+
this.handlerArrow();
|
|
80
|
+
}
|
|
81
|
+
disconnectedCallback() {
|
|
82
|
+
}
|
|
83
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
84
|
+
if (name === "transit" && newValue) {
|
|
85
|
+
addClassToElement(this.dropdown.element, this.transit);
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
removeClassToElement(this.dropdown.element, this.transit);
|
|
88
|
+
}, animationTime);
|
|
89
|
+
}
|
|
90
|
+
if (name === "arrow") {
|
|
91
|
+
this.handlerArrow();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function Custom() {
|
|
96
|
+
if (typeof document !== "undefined" && !customElements.get("r-dropdown")) {
|
|
97
|
+
customElements.define("r-dropdown", Dropdown);
|
|
98
|
+
return Dropdown;
|
|
99
|
+
} else {
|
|
100
|
+
return createCustomError("document is undefined or r-dropdown is exist");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
Custom();
|
|
@@ -1,12 +1,9 @@
|
|
|
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
|
-
import { c as createDocumentFragment, a as addClassToElement } from "./index-7913ec46.js";
|
|
8
|
-
import { i as isDisabled, r as removeClassToElementChild } 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}.ran-tab ::slotted(r-tab){box-sizing:border-box;width:100%;height:100%;padding:10px;flex-shrink:0;overflow:auto;text-align:start}.ran-tab-header{position:relative;overflow:hidden;scroll-behavior:smooth}.ran-tab-header-nav{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center}.ran-tab-header-nav::-webkit-scrollbar{display:none}.ran-tab-header-nav-item{flex-shrink:0}.ran-tab-header-nav .active{color:var(--active-color, #1890ff)}.ran-tab-header-line{position:absolute;width:0;margin-top:-2px;height:2px;border-radius:2px;background:var(--line-color, #1890ff);transition:.2s}.ran-tab-content{overflow:hidden}.ran-tab-content-wrap{display:flex;width:100%;height:100%;transition:.2s}:host([type="line"]) .ran-tab-header-nav-item{border:solid 1px transparent}:host([type="line"]) .ran-tab-header-nav .active{color:var(--line-color, #1890ff);border:solid 1px transparent;border-color:var(--border-color, rgba(0, 0, 0, .2)) var(--border-color, rgba(0, 0, 0, .2)) transparent;border-radius:var(--border-radius, .25em) var(--border-radius, .25em) 0 0}:host([type="line"]) .ran-tab-header-line{transition:none;visibility:hidden}:host([type="line"]) .ran-tab-header-line:after,:host([type="line"]) .ran-tab-header-line:before{content:"";position:absolute;visibility:visible;width:9999px;height:1px;bottom:0;background:var(--border-color, rgba(0, 0, 0, .2))}:host([type="line"]) .ran-tab-header-line:after{left:100%}:host([type="line"]) .ran-tab-header-line:before{right:100%}:host([align="center"]) .ran-tab-header-nav{justify-content:center}:host([align="center"]) .ran-tab-header-line{left:50%}:host([align="end"]) .ran-tab-header-nav{justify-content:flex-end}\n';
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { d as createDocumentFragment, a as addClassToElement } from "./arrow-down-B_hCY3Wt.js";
|
|
5
|
+
import { i as isDisabled, r as removeClassToElementChild } 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}.ran-tab ::slotted(r-tab){box-sizing:border-box;width:100%;height:100%;padding:10px;flex-shrink:0;overflow:auto;text-align:start}.ran-tab-header{position:relative;overflow:hidden;scroll-behavior:smooth}.ran-tab-header-nav{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center}.ran-tab-header-nav::-webkit-scrollbar{display:none}.ran-tab-header-nav-item{flex-shrink:0}.ran-tab-header-nav .active{color:var(--active-color, #1890ff)}.ran-tab-header-line{position:absolute;width:0;margin-top:-2px;height:2px;border-radius:2px;background:var(--line-color, #1890ff);transition:.2s}.ran-tab-content{overflow:hidden}.ran-tab-content-wrap{display:flex;width:100%;height:100%;transition:.2s}:host([type="line"]) .ran-tab-header-nav-item{border:solid 1px transparent}:host([type="line"]) .ran-tab-header-nav .active{color:var(--line-color, #1890ff);border:solid 1px transparent;border-color:var(--border-color, rgba(0, 0, 0, .2)) var(--border-color, rgba(0, 0, 0, .2)) transparent;border-radius:var(--border-radius, .25em) var(--border-radius, .25em) 0 0}:host([type="line"]) .ran-tab-header-line{transition:none;visibility:hidden}:host([type="line"]) .ran-tab-header-line:after,:host([type="line"]) .ran-tab-header-line:before{content:"";position:absolute;visibility:visible;width:9999px;height:1px;bottom:0;background:var(--border-color, rgba(0, 0, 0, .2))}:host([type="line"]) .ran-tab-header-line:after{left:100%}:host([type="line"]) .ran-tab-header-line:before{right:100%}:host([align="center"]) .ran-tab-header-nav{justify-content:center}:host([align="center"]) .ran-tab-header-line{left:50%}:host([align="end"]) .ran-tab-header-nav{justify-content:flex-end}';
|
|
10
7
|
function CustomElement() {
|
|
11
8
|
if (typeof window !== "undefined" && !customElements.get("r-tabs")) {
|
|
12
9
|
class Tabs extends HTMLElement {
|
|
@@ -21,22 +18,20 @@ function CustomElement() {
|
|
|
21
18
|
__publicField(this, "_slot");
|
|
22
19
|
__publicField(this, "tabHeaderKeyMapIndex");
|
|
23
20
|
/**
|
|
24
|
-
* @description: 构建tabPane组件key值和index的映射,同时判断一个tabs下的tabPane key值不能重复
|
|
21
|
+
* @description: 构建 tabPane 组件 key 值和 index 的映射,同时判断一个 tabs 下的 tabPane key 值不能重复
|
|
25
22
|
* @param {string} key
|
|
26
23
|
* @param {number} index
|
|
27
24
|
*/
|
|
28
25
|
__publicField(this, "initTabHeaderKeyMapIndex", (key, index2) => {
|
|
29
26
|
const value = this.tabHeaderKeyMapIndex[key];
|
|
30
27
|
if (value) {
|
|
31
|
-
throw new Error(
|
|
32
|
-
"tab 组件的 key 值存在重复, 或者某个 tab 组件缺少 key 属性"
|
|
33
|
-
);
|
|
28
|
+
throw new Error("tab 组件的 key 值存在重复,或者某个 tab 组件缺少 key 属性");
|
|
34
29
|
} else {
|
|
35
30
|
this.tabHeaderKeyMapIndex[key] = index2;
|
|
36
31
|
}
|
|
37
32
|
});
|
|
38
33
|
/**
|
|
39
|
-
* @description: 初始化tabLine的位置,主要是当tabs的align属性为center时需要处理
|
|
34
|
+
* @description: 初始化 tabLine 的位置,主要是当 tabs 的 align 属性为 center 时需要处理
|
|
40
35
|
*/
|
|
41
36
|
__publicField(this, "initTabLineAlignCenter", () => {
|
|
42
37
|
const { length } = this._nav.children;
|
|
@@ -75,10 +70,7 @@ function CustomElement() {
|
|
|
75
70
|
const { width: width2 = 0 } = item.getBoundingClientRect();
|
|
76
71
|
distance += width2;
|
|
77
72
|
}
|
|
78
|
-
this._line.style.setProperty(
|
|
79
|
-
"transform",
|
|
80
|
-
`translateX(${distance}px)`
|
|
81
|
-
);
|
|
73
|
+
this._line.style.setProperty("transform", `translateX(${distance}px)`);
|
|
82
74
|
}
|
|
83
75
|
});
|
|
84
76
|
/**
|
|
@@ -87,14 +79,11 @@ function CustomElement() {
|
|
|
87
79
|
__publicField(this, "setTabContent", (key) => {
|
|
88
80
|
if (key) {
|
|
89
81
|
const index2 = this.tabHeaderKeyMapIndex[key];
|
|
90
|
-
this._wrap.style.setProperty(
|
|
91
|
-
"transform",
|
|
92
|
-
`translateX(${index2 * -100}%)`
|
|
93
|
-
);
|
|
82
|
+
this._wrap.style.setProperty("transform", `translateX(${index2 * -100}%)`);
|
|
94
83
|
}
|
|
95
84
|
});
|
|
96
85
|
/**
|
|
97
|
-
* @description: 根据点击设置tabLine的位置
|
|
86
|
+
* @description: 根据点击设置 tabLine 的位置
|
|
98
87
|
* @param {Event} e
|
|
99
88
|
* @param {number} index
|
|
100
89
|
* @param {number} width
|
|
@@ -126,23 +115,20 @@ function CustomElement() {
|
|
|
126
115
|
}
|
|
127
116
|
});
|
|
128
117
|
/**
|
|
129
|
-
* @description: 初始化tabs的active属性和tabLine,tabContent
|
|
118
|
+
* @description: 初始化 tabs 的 active 属性和 tabLine,tabContent
|
|
130
119
|
*/
|
|
131
120
|
__publicField(this, "initActive", () => {
|
|
132
121
|
const tabHeaderList = [...this._nav.children];
|
|
133
122
|
const initTabList = tabHeaderList.filter((item) => !isDisabled(item));
|
|
134
123
|
let initTabHeader;
|
|
135
124
|
if (this.active != null) {
|
|
136
|
-
initTabHeader = initTabList.find(
|
|
137
|
-
(item) => item.getAttribute("r-key") === this.active
|
|
138
|
-
);
|
|
125
|
+
initTabHeader = initTabList.find((item) => item.getAttribute("r-key") === this.active);
|
|
139
126
|
initTabHeader == null ? void 0 : initTabHeader.setAttribute("r-key", this.active);
|
|
140
127
|
}
|
|
141
128
|
if (!initTabHeader) {
|
|
142
129
|
initTabHeader = initTabList.shift();
|
|
143
130
|
}
|
|
144
|
-
if (!initTabHeader)
|
|
145
|
-
return;
|
|
131
|
+
if (!initTabHeader) return;
|
|
146
132
|
const index2 = tabHeaderList.findIndex((item) => item === initTabHeader);
|
|
147
133
|
const key = (initTabHeader == null ? void 0 : initTabHeader.getAttribute("r-key")) || `${index2}`;
|
|
148
134
|
if (key != null) {
|
|
@@ -155,7 +141,7 @@ function CustomElement() {
|
|
|
155
141
|
}
|
|
156
142
|
});
|
|
157
143
|
/**
|
|
158
|
-
* @description: 监听slot组件的添加/删除/替换操作,进行tabs初始化
|
|
144
|
+
* @description: 监听 slot 组件的添加/删除/替换操作,进行 tabs 初始化
|
|
159
145
|
* @return {*}
|
|
160
146
|
*/
|
|
161
147
|
__publicField(this, "listenSlotChange", () => {
|
|
@@ -167,20 +153,18 @@ function CustomElement() {
|
|
|
167
153
|
});
|
|
168
154
|
this.initActive();
|
|
169
155
|
if (this.align) {
|
|
170
|
-
if (this.align === "center")
|
|
171
|
-
|
|
172
|
-
if (this.align === "end")
|
|
173
|
-
this.initTabLineAlignEnd();
|
|
156
|
+
if (this.align === "center") this.initTabLineAlignCenter();
|
|
157
|
+
if (this.align === "end") this.initTabLineAlignEnd();
|
|
174
158
|
}
|
|
175
159
|
});
|
|
176
160
|
/**
|
|
177
|
-
* @description: 初始化tab
|
|
161
|
+
* @description: 初始化 tab
|
|
178
162
|
*/
|
|
179
163
|
__publicField(this, "initTab", () => {
|
|
180
164
|
this._slot.addEventListener("slotchange", this.listenSlotChange);
|
|
181
165
|
});
|
|
182
166
|
/**
|
|
183
|
-
* @description: 卸载tab
|
|
167
|
+
* @description: 卸载 tab
|
|
184
168
|
*/
|
|
185
169
|
__publicField(this, "unloadTab", () => {
|
|
186
170
|
this._slot.removeEventListener("slotchange", this.listenSlotChange);
|
|
@@ -200,12 +184,8 @@ function CustomElement() {
|
|
|
200
184
|
this._slot = document.createElement("slot");
|
|
201
185
|
this._wrap.appendChild(this._slot);
|
|
202
186
|
this._content.appendChild(this._wrap);
|
|
203
|
-
this._header.appendChild(
|
|
204
|
-
|
|
205
|
-
);
|
|
206
|
-
this._container.appendChild(
|
|
207
|
-
createDocumentFragment([this._header, this._content])
|
|
208
|
-
);
|
|
187
|
+
this._header.appendChild(createDocumentFragment([this._nav, this._line]));
|
|
188
|
+
this._container.appendChild(createDocumentFragment([this._header, this._content]));
|
|
209
189
|
this.tabHeaderKeyMapIndex = {};
|
|
210
190
|
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
211
191
|
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
@@ -251,7 +231,7 @@ function CustomElement() {
|
|
|
251
231
|
}
|
|
252
232
|
}
|
|
253
233
|
/**
|
|
254
|
-
* @description: 根据传入的tabPane生成tabs的头部
|
|
234
|
+
* @description: 根据传入的 tabPane 生成 tabs 的头部
|
|
255
235
|
* @param {Element} tabPane
|
|
256
236
|
* @param {number} index
|
|
257
237
|
* @return {Element}
|
|
@@ -294,10 +274,8 @@ function CustomElement() {
|
|
|
294
274
|
})
|
|
295
275
|
);
|
|
296
276
|
if (name === "align") {
|
|
297
|
-
if (newValue === "center")
|
|
298
|
-
|
|
299
|
-
if (newValue === "end")
|
|
300
|
-
this.initTabLineAlignEnd();
|
|
277
|
+
if (newValue === "center") this.initTabLineAlignCenter();
|
|
278
|
+
if (newValue === "end") this.initTabLineAlignEnd();
|
|
301
279
|
}
|
|
302
280
|
if (name === "effect") {
|
|
303
281
|
const tabHeaderList = [...this._nav.children];
|