ranui 0.1.9 → 0.1.10-alpha-24
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 +192 -0
- package/dist/assets/image/failImage.d.ts +2 -0
- package/dist/button.js +7 -0
- package/dist/checkbox.js +7 -0
- package/dist/colorpicker.js +11 -0
- package/dist/components/button/index.d.ts +8 -5
- package/dist/components/checkbox/index.d.ts +30 -0
- package/dist/components/colorpicker/index.d.ts +120 -0
- package/dist/components/dropdown/index.d.ts +34 -0
- package/dist/components/input/index.d.ts +66 -41
- package/dist/components/loading/index.d.ts +76 -0
- package/dist/components/math/index.d.ts +16 -0
- package/dist/components/message/index.d.ts +10 -7
- package/dist/components/player/index.d.ts +46 -9
- package/dist/components/popover/content/index.d.ts +16 -0
- package/dist/components/popover/index.d.ts +91 -0
- package/dist/components/preview/constant.d.ts +5 -0
- package/dist/components/preview/index.d.ts +1 -4
- package/dist/components/preview/pdf.d.ts +51 -1
- package/dist/components/preview/types.d.ts +11 -0
- package/dist/components/progress/index.d.ts +12 -7
- package/dist/components/radar/index.d.ts +1 -1
- package/dist/components/scratch/index.d.ts +7 -5
- package/dist/components/select/dropdown-item/index.d.ts +23 -0
- package/dist/components/select/index.d.ts +22 -13
- package/dist/components/select/option/index.d.ts +2 -0
- package/dist/components/tab/index.d.ts +80 -64
- package/dist/components/tabpane/index.d.ts +73 -57
- package/dist/icon.js +6 -0
- package/dist/iconShadowless.js +6 -0
- package/dist/image.js +4 -0
- package/dist/{index-01b17e26.js → index-BEm1a2pr.js} +3 -6
- package/dist/{index-e2e5d725.js → index-BSyn-jmY.js} +4734 -2976
- package/dist/index-BVD0qcjJ.js +656 -0
- package/dist/{index-e03d23e7.js → index-Bb55l8nf.js} +2 -11
- package/dist/{index-0d5b9435.js → index-BbW0dxzy.js} +12 -16
- package/dist/index-BgUpm4LA.js +103 -0
- package/dist/{index-458debf7.js → index-C841uRgZ.js} +16 -51
- package/dist/{index-4443363f.js → index-CUZna268.js} +41 -69
- package/dist/index-CiA5qRK3.js +381 -0
- package/dist/index-CoJMn8Jm.js +511 -0
- package/dist/{index-b7790662.js → index-DAxs7Dd2.js} +6 -13
- package/dist/index-D_cD4u43.js +70 -0
- package/dist/index-DgVgxN1s.js +309 -0
- package/dist/index-DghvN1MU.js +710 -0
- package/dist/index-DvSe_Ms7.js +494 -0
- package/dist/{index-7216d6b0.js → index-W52VzrXL.js} +20 -49
- package/dist/index-gBy2cXLV.js +140 -0
- package/dist/index-hdtEL8P_.js +101 -0
- package/dist/{index-1048a998.js → index-jVKJoKXA.js} +105 -62
- package/dist/{index-2d16a084.js → index-ltt3w4zP.js} +13 -23
- package/dist/index-n4X6wdwJ.js +156 -0
- package/dist/{index-3cf72afd.js → index-s0ioL3L2.js} +23 -45
- package/dist/index.d.ts +276 -14
- package/dist/index.js +24 -24
- package/dist/input.js +7 -0
- package/dist/inputShadowless.js +6 -0
- package/dist/katex-es-CGqSCDjs.js +14634 -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/more-2vsTDpcc.js +31 -0
- package/dist/pdf-Bis_tkvj.js +134 -0
- package/dist/player.js +8 -0
- package/dist/plus-DgJxWGlo.js +56799 -0
- package/dist/popover.js +9 -0
- package/dist/preview.js +7 -0
- package/dist/progress.js +7 -0
- package/dist/radar.js +6 -0
- package/dist/ranui.css +1 -0
- package/dist/search-BWdfjyP8.js +4 -0
- package/dist/select.js +10 -0
- package/dist/{index-1b73beee.js → selectShadowless.js} +159 -167
- package/dist/{umd/components → shadowless}/icon/index.d.ts +1 -0
- package/dist/{umd/components → shadowless}/input/index.d.ts +66 -41
- package/dist/{umd/components → shadowless}/select/index.d.ts +19 -16
- package/dist/shadowless/select/option/index.d.ts +2 -0
- package/dist/shadowless.d.ts +3 -0
- package/dist/shadowless.js +8 -0
- package/dist/skeleton.js +4 -0
- package/dist/sort-DWqiUONr.js +4 -0
- package/dist/sprite-CH2zLtZy.js +141 -0
- package/dist/tab.js +6 -0
- package/dist/tabpane.js +4 -0
- package/dist/tsconfig.json +31 -0
- package/dist/typings.d.ts +257 -0
- package/dist/umd/index.css +1 -0
- package/dist/umd/index.umd.cjs +1 -71
- package/dist/umd/shadowless/shadowless.css +1 -0
- package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
- package/dist/utils/color.d.ts +52 -0
- package/dist/utils/image.d.ts +8 -1
- package/dist/utils/index.d.ts +20 -5
- package/dist/utils/math.d.ts +3 -3
- package/dist/vite.config.d.ts +1 -0
- package/dist/without-content-CdJw7vHM.js +4 -0
- package/package.json +115 -64
- package/readme.md +41 -57
- package/typings.d.ts +257 -0
- package/dist/colz-746223ab.js +0 -241
- package/dist/components/button/index.js +0 -8
- package/dist/components/icon/index.js +0 -6
- package/dist/components/image/index.js +0 -4
- package/dist/components/input/index.js +0 -6
- package/dist/components/message/index.js +0 -4
- 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.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.js +0 -8
- 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.js +0 -8
- package/dist/components/radar/index.js +0 -7
- package/dist/components/select/index.js +0 -11
- package/dist/components/skeleton/index.js +0 -4
- package/dist/components/tab/index.js +0 -7
- package/dist/components/tabpane/index.js +0 -4
- package/dist/docx-c5d02d8c.js +0 -21
- package/dist/index-57492b9b.js +0 -48
- package/dist/index-73ce455b.js +0 -264
- package/dist/index-7913ec46.js +0 -239
- package/dist/index-7b8840f9.js +0 -18690
- package/dist/index-c14450a9.js +0 -662
- package/dist/pdf-bdb7818a.js +0 -113
- package/dist/style.css +0 -1
- package/dist/umd/build/config.d.ts +0 -3
- package/dist/umd/build/config.umd.d.ts +0 -2
- package/dist/umd/components/button/index.d.ts +0 -35
- package/dist/umd/components/form/index.d.ts +0 -2
- package/dist/umd/components/image/index.d.ts +0 -2
- package/dist/umd/components/message/index.d.ts +0 -14
- package/dist/umd/components/modal/index.d.ts +0 -2
- package/dist/umd/components/option/index.d.ts +0 -2
- package/dist/umd/components/player/index.d.ts +0 -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/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/style.css +0 -1
- package/dist/umd/tests/button.spec.d.ts +0 -1
- package/dist/umd/utils/image.d.ts +0 -32
- package/dist/umd/utils/index.d.ts +0 -64
- package/dist/umd/utils/math.d.ts +0 -26
- package/dist/umd/utils/tween.d.ts +0 -21
- package/dist/umd/vite.config.d.ts +0 -6
- package/dist/vendor-f71e6f68.js +0 -92126
- /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
- /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
- /package/dist/{umd/build/config.es.d.ts → build/config.sha.d.ts} +0 -0
- /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
- /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
- /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
- /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
- /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
- /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
- /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
- /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
- /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
- /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
- /package/dist/{info-circle-fill-90ec9aa9.js → info-circle-fill-DjI8gXS3.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,381 @@
|
|
|
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, i as isMobile, e as debounce } from "./plus-DgJxWGlo.js";
|
|
5
|
+
import { c as createCustomError, H as HTMLElementSSR } from "./index-hdtEL8P_.js";
|
|
6
|
+
import "./index-BgUpm4LA.js";
|
|
7
|
+
const f7170ee498e0dd32cbdcb63fba8f75cc = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{display:var(--ran-popover-host-display, block)}.ran-popover{box-sizing:var(--ran-popover-box-sizing, border-box);position:var(--ran-popover-position, relative);display:var(--ran-popover-display, block);margin:var(--ran-popover-margin, 0);padding:var(--ran-popover-padding, 0)}.ran-popover-block{display:var(--ran-popover-block-display, block)}";
|
|
8
|
+
const less = ".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{visibility:hidden;position:absolute}";
|
|
9
|
+
class Content extends HTMLElementSSR() {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
__publicField(this, "observer");
|
|
13
|
+
__publicField(this, "_shadowDom");
|
|
14
|
+
__publicField(this, "_slot");
|
|
15
|
+
__publicField(this, "callback", (mutations) => {
|
|
16
|
+
for (const mutation of mutations) {
|
|
17
|
+
if (mutation.type === "childList") {
|
|
18
|
+
this.onChange(mutation);
|
|
19
|
+
} else if (mutation.type === "attributes") {
|
|
20
|
+
this.onChange(mutation);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
__publicField(this, "onChange", (mutation) => {
|
|
25
|
+
this.dispatchEvent(
|
|
26
|
+
new CustomEvent("change", {
|
|
27
|
+
detail: {
|
|
28
|
+
type: mutation.type,
|
|
29
|
+
value: { content: this.children, mutation }
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
this._slot = create("slot").setAttribute("class", "slot").element;
|
|
35
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
36
|
+
this._shadowDom = shadowRoot;
|
|
37
|
+
const style = create("style").setTextContent(less);
|
|
38
|
+
shadowRoot.appendChild(style.element);
|
|
39
|
+
shadowRoot.appendChild(this._slot);
|
|
40
|
+
this.observer = new MutationObserver(this.callback);
|
|
41
|
+
}
|
|
42
|
+
connectedCallback() {
|
|
43
|
+
this.observer.observe(this, { attributes: true, childList: true, subtree: true });
|
|
44
|
+
}
|
|
45
|
+
disconnectCallback() {
|
|
46
|
+
this.observer.disconnect();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function Custom$1() {
|
|
50
|
+
if (typeof document !== "undefined" && !customElements.get("r-content")) {
|
|
51
|
+
customElements.define("r-content", Content);
|
|
52
|
+
return Content;
|
|
53
|
+
} else {
|
|
54
|
+
return createCustomError("document is undefined or r-content is exist");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
Custom$1();
|
|
58
|
+
const arrowHeight = 8;
|
|
59
|
+
const animationTime = 300;
|
|
60
|
+
const HOVER_TIME = 16;
|
|
61
|
+
const placementDirection = {
|
|
62
|
+
bottom: {
|
|
63
|
+
add: "ran-dropdown-down-in",
|
|
64
|
+
remove: "ran-dropdown-down-out"
|
|
65
|
+
},
|
|
66
|
+
top: {
|
|
67
|
+
add: "ran-dropdown-up-in",
|
|
68
|
+
remove: "ran-dropdown-up-out"
|
|
69
|
+
},
|
|
70
|
+
left: {
|
|
71
|
+
add: "ran-dropdown-left-in",
|
|
72
|
+
remove: "ran-dropdown-left-out"
|
|
73
|
+
},
|
|
74
|
+
right: {
|
|
75
|
+
add: "ran-dropdown-right-in",
|
|
76
|
+
remove: "ran-dropdown-right-out"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var PLACEMENT_TYPE = /* @__PURE__ */ ((PLACEMENT_TYPE2) => {
|
|
80
|
+
PLACEMENT_TYPE2["TOP"] = "top";
|
|
81
|
+
PLACEMENT_TYPE2["BOTTOM"] = "bottom";
|
|
82
|
+
PLACEMENT_TYPE2["LEFT"] = "left";
|
|
83
|
+
PLACEMENT_TYPE2["RIGHT"] = "right";
|
|
84
|
+
return PLACEMENT_TYPE2;
|
|
85
|
+
})(PLACEMENT_TYPE || {});
|
|
86
|
+
class Popover extends HTMLElementSSR() {
|
|
87
|
+
constructor() {
|
|
88
|
+
super();
|
|
89
|
+
__publicField(this, "_slot");
|
|
90
|
+
__publicField(this, "popoverBlock");
|
|
91
|
+
__publicField(this, "popoverContent");
|
|
92
|
+
__publicField(this, "popoverInner");
|
|
93
|
+
__publicField(this, "popoverInnerBlock");
|
|
94
|
+
__publicField(this, "_shadowDom");
|
|
95
|
+
__publicField(this, "dropDownInTimeId");
|
|
96
|
+
__publicField(this, "dropDownOutTimeId");
|
|
97
|
+
__publicField(this, "removeTimeId");
|
|
98
|
+
__publicField(this, "closePopover", () => {
|
|
99
|
+
this.setDropdownDisplayNone();
|
|
100
|
+
});
|
|
101
|
+
__publicField(this, "stopPropagation", (e) => {
|
|
102
|
+
e.stopPropagation();
|
|
103
|
+
});
|
|
104
|
+
/**
|
|
105
|
+
* @description: 创建下拉框
|
|
106
|
+
* @param {HTMLCollection} content
|
|
107
|
+
* @return {*}
|
|
108
|
+
*/
|
|
109
|
+
__publicField(this, "createContent", (content) => {
|
|
110
|
+
var _a, _b, _c;
|
|
111
|
+
if (!content) return;
|
|
112
|
+
if (!this.popoverContent) {
|
|
113
|
+
const div = document.createElement("div");
|
|
114
|
+
this.popoverContent = create("r-dropdown").setAttribute("class", "ran-popover-dropdown").setStyle("display", "none").setStyle("position", "absolute").element;
|
|
115
|
+
(_a = this.popoverContent) == null ? void 0 : _a.addEventListener("click", this.stopPropagation);
|
|
116
|
+
this.popoverContent && div.appendChild(this.popoverContent);
|
|
117
|
+
if (this.trigger.includes("hover") && !isMobile()) {
|
|
118
|
+
(_b = this.popoverContent) == null ? void 0 : _b.addEventListener("mouseleave", this.blur);
|
|
119
|
+
(_c = this.popoverContent) == null ? void 0 : _c.addEventListener("mouseenter", this.removeDropDownTimeId);
|
|
120
|
+
}
|
|
121
|
+
document.body.appendChild(div);
|
|
122
|
+
}
|
|
123
|
+
if (this.popoverContent && content.length > 0) {
|
|
124
|
+
this.popoverContent.innerHTML = "";
|
|
125
|
+
const Fragment = document.createDocumentFragment();
|
|
126
|
+
for (const child of content) {
|
|
127
|
+
Fragment.appendChild(child);
|
|
128
|
+
}
|
|
129
|
+
this.popoverContent.appendChild(Fragment);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
/**
|
|
133
|
+
* @description: 观察内容变化
|
|
134
|
+
* @param {Event} e
|
|
135
|
+
* @return {*}
|
|
136
|
+
*/
|
|
137
|
+
__publicField(this, "watchContent", (e) => {
|
|
138
|
+
const { value } = e.detail;
|
|
139
|
+
this.createContent(value.content);
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* @description: 焦点移除的情况,需要移除下拉框
|
|
143
|
+
* @return {*}
|
|
144
|
+
*/
|
|
145
|
+
__publicField(this, "blur", debounce(() => {
|
|
146
|
+
if (this.removeTimeId) {
|
|
147
|
+
this.removeDropDownTimeId();
|
|
148
|
+
}
|
|
149
|
+
this.removeTimeId = setTimeout(() => {
|
|
150
|
+
this.removeDropDownTimeId();
|
|
151
|
+
this.setDropdownDisplayNone();
|
|
152
|
+
}, animationTime);
|
|
153
|
+
}, HOVER_TIME));
|
|
154
|
+
/**
|
|
155
|
+
* @description: 移除下拉框
|
|
156
|
+
* @return {*}
|
|
157
|
+
*/
|
|
158
|
+
__publicField(this, "removeDropDownTimeId", debounce(() => {
|
|
159
|
+
if (this.trigger.includes("hover") && !isMobile()) {
|
|
160
|
+
clearTimeout(this.removeTimeId);
|
|
161
|
+
this.removeTimeId = void 0;
|
|
162
|
+
}
|
|
163
|
+
}, HOVER_TIME));
|
|
164
|
+
/**
|
|
165
|
+
* @description: 添加 dropdown
|
|
166
|
+
* @return {*}
|
|
167
|
+
*/
|
|
168
|
+
__publicField(this, "setDropdownDisplayBlock", debounce(() => {
|
|
169
|
+
var _a;
|
|
170
|
+
if (this.dropDownInTimeId) return;
|
|
171
|
+
clearTimeout(this.dropDownInTimeId);
|
|
172
|
+
this.dropDownInTimeId = void 0;
|
|
173
|
+
clearTimeout(this.dropDownOutTimeId);
|
|
174
|
+
this.dropDownOutTimeId = void 0;
|
|
175
|
+
if (this.popoverContent && this.popoverContent.style.display !== "block") {
|
|
176
|
+
this.popoverContent.setAttribute("transit", placementDirection[this.placement].add);
|
|
177
|
+
(_a = this.popoverContent) == null ? void 0 : _a.style.setProperty("display", "block");
|
|
178
|
+
this.placementPosition();
|
|
179
|
+
this.dropDownInTimeId = setTimeout(() => {
|
|
180
|
+
this.popoverContent && this.popoverContent.removeAttribute("transit");
|
|
181
|
+
clearTimeout(this.dropDownInTimeId);
|
|
182
|
+
this.dropDownInTimeId = void 0;
|
|
183
|
+
}, animationTime);
|
|
184
|
+
}
|
|
185
|
+
}, HOVER_TIME));
|
|
186
|
+
/**
|
|
187
|
+
* @description: 移除 select dropdown
|
|
188
|
+
* @return {*}
|
|
189
|
+
*/
|
|
190
|
+
__publicField(this, "setDropdownDisplayNone", debounce(() => {
|
|
191
|
+
if (this.dropDownOutTimeId) return;
|
|
192
|
+
clearTimeout(this.dropDownInTimeId);
|
|
193
|
+
this.dropDownInTimeId = void 0;
|
|
194
|
+
clearTimeout(this.dropDownOutTimeId);
|
|
195
|
+
this.dropDownOutTimeId = void 0;
|
|
196
|
+
if (this.popoverContent && this.popoverContent.style.display !== "none") {
|
|
197
|
+
this.popoverContent.setAttribute("transit", placementDirection[this.placement].remove);
|
|
198
|
+
this.dropDownOutTimeId = setTimeout(() => {
|
|
199
|
+
var _a;
|
|
200
|
+
(_a = this.popoverContent) == null ? void 0 : _a.style.setProperty("display", "none");
|
|
201
|
+
this.popoverContent && this.popoverContent.removeAttribute("transit");
|
|
202
|
+
clearTimeout(this.dropDownOutTimeId);
|
|
203
|
+
this.dropDownOutTimeId = void 0;
|
|
204
|
+
}, animationTime);
|
|
205
|
+
}
|
|
206
|
+
}, HOVER_TIME));
|
|
207
|
+
/**
|
|
208
|
+
* @description: 设置 popover 位置
|
|
209
|
+
* @param {*} void
|
|
210
|
+
* @return {*}
|
|
211
|
+
*/
|
|
212
|
+
__publicField(this, "placementPosition", () => {
|
|
213
|
+
if (!this.popoverContent) return;
|
|
214
|
+
const rect = this.getBoundingClientRect();
|
|
215
|
+
const { top, left, bottom, width, height } = rect;
|
|
216
|
+
let popoverTop = bottom + window.scrollY + arrowHeight;
|
|
217
|
+
let popoverLeft = left + window.scrollX;
|
|
218
|
+
const root = document.getElementById(this.getPopupContainerId);
|
|
219
|
+
const popoverContentRect = this.popoverContent.getBoundingClientRect();
|
|
220
|
+
if (this.placement === "top") {
|
|
221
|
+
popoverTop = top + window.scrollY - Math.max(popoverContentRect.height, height) - arrowHeight;
|
|
222
|
+
if (this.getPopupContainerId && root) {
|
|
223
|
+
const rootRect = root.getBoundingClientRect();
|
|
224
|
+
popoverLeft = left - rootRect.left;
|
|
225
|
+
popoverTop = top - root.getBoundingClientRect().top - this.popoverContent.clientHeight - arrowHeight;
|
|
226
|
+
popoverLeft = left - root.getBoundingClientRect().left;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (this.placement === "left") {
|
|
230
|
+
popoverLeft = left - Math.max(popoverContentRect.width, width) - arrowHeight;
|
|
231
|
+
popoverTop = top + window.scrollY;
|
|
232
|
+
}
|
|
233
|
+
if (this.placement === "right") {
|
|
234
|
+
popoverLeft = left + width + arrowHeight;
|
|
235
|
+
popoverTop = top + window.scrollY;
|
|
236
|
+
}
|
|
237
|
+
this.popoverContent.style.setProperty("inset", `${popoverTop}px auto auto ${popoverLeft}px`);
|
|
238
|
+
this.popoverContent.style.setProperty("--ran-x", `${popoverLeft}px`);
|
|
239
|
+
this.popoverContent.style.setProperty("--ran-y", `${popoverTop}px`);
|
|
240
|
+
this.popoverContent.style.setProperty("--ran-popover-width", `${width}px`);
|
|
241
|
+
this.popoverContent.style.setProperty("--ran-popover-height", `${height}px`);
|
|
242
|
+
this.popoverContent.style.setProperty("--ran-popover-content-width", `${popoverContentRect.width}px`);
|
|
243
|
+
this.popoverContent.style.setProperty("--ran-popover-content-height", `${popoverContentRect.height}px`);
|
|
244
|
+
});
|
|
245
|
+
/**
|
|
246
|
+
* @description: 鼠标移入
|
|
247
|
+
* @param {Event} e
|
|
248
|
+
* @return {*}
|
|
249
|
+
*/
|
|
250
|
+
__publicField(this, "hoverPopover", (e) => {
|
|
251
|
+
this.clickPopover(e);
|
|
252
|
+
});
|
|
253
|
+
__publicField(this, "clickContent", (e) => {
|
|
254
|
+
e.stopPropagation();
|
|
255
|
+
});
|
|
256
|
+
__publicField(this, "clickPopover", (e) => {
|
|
257
|
+
e.stopPropagation();
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
this.setDropdownDisplayBlock();
|
|
260
|
+
});
|
|
261
|
+
__publicField(this, "clickRemovePopover", (e) => {
|
|
262
|
+
this.hoverRemovePopover(e);
|
|
263
|
+
});
|
|
264
|
+
__publicField(this, "popoverTrigger", () => {
|
|
265
|
+
this.removeEventListener("mouseenter", this.hoverPopover);
|
|
266
|
+
this.removeEventListener("mouseleave", this.blur);
|
|
267
|
+
this.removeEventListener("click", this.clickPopover);
|
|
268
|
+
if (this.trigger.includes("hover")) {
|
|
269
|
+
this.addEventListener("mouseenter", this.hoverPopover);
|
|
270
|
+
this.addEventListener("mouseleave", this.blur);
|
|
271
|
+
}
|
|
272
|
+
this.addEventListener("click", this.clickPopover);
|
|
273
|
+
});
|
|
274
|
+
__publicField(this, "hoverRemovePopover", (e) => {
|
|
275
|
+
e.stopPropagation();
|
|
276
|
+
this.setDropdownDisplayNone();
|
|
277
|
+
});
|
|
278
|
+
__publicField(this, "changePlacement", debounce(() => {
|
|
279
|
+
var _a, _b, _c, _d;
|
|
280
|
+
if (this.placement === "top") {
|
|
281
|
+
(_a = this.popoverContent) == null ? void 0 : _a.setAttribute("arrow", "bottom");
|
|
282
|
+
}
|
|
283
|
+
if (this.placement === "bottom") {
|
|
284
|
+
(_b = this.popoverContent) == null ? void 0 : _b.setAttribute("arrow", "top");
|
|
285
|
+
}
|
|
286
|
+
if (this.placement === "left") {
|
|
287
|
+
(_c = this.popoverContent) == null ? void 0 : _c.setAttribute("arrow", "right");
|
|
288
|
+
}
|
|
289
|
+
if (this.placement === "right") {
|
|
290
|
+
(_d = this.popoverContent) == null ? void 0 : _d.setAttribute("arrow", "left");
|
|
291
|
+
}
|
|
292
|
+
}, HOVER_TIME));
|
|
293
|
+
this._slot = document.createElement("slot");
|
|
294
|
+
this._slot.setAttribute("class", "slot");
|
|
295
|
+
this.popoverBlock = document.createElement("div");
|
|
296
|
+
this.popoverBlock.setAttribute("class", "ran-popover-block");
|
|
297
|
+
this.popoverBlock.setAttribute("role", "tooltip");
|
|
298
|
+
this.popoverBlock.appendChild(this._slot);
|
|
299
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
300
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
301
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
302
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
303
|
+
this._shadowDom = shadowRoot;
|
|
304
|
+
shadowRoot.appendChild(this.popoverBlock);
|
|
305
|
+
}
|
|
306
|
+
static get observedAttributes() {
|
|
307
|
+
return ["placement", "arrow", "trigger"];
|
|
308
|
+
}
|
|
309
|
+
get placement() {
|
|
310
|
+
return this.getAttribute("placement") || "top";
|
|
311
|
+
}
|
|
312
|
+
set placement(value) {
|
|
313
|
+
this.setAttribute("placement", value);
|
|
314
|
+
}
|
|
315
|
+
get arrow() {
|
|
316
|
+
return this.getAttribute("arrow") || "";
|
|
317
|
+
}
|
|
318
|
+
set arrow(value) {
|
|
319
|
+
this.setAttribute("arrow", value);
|
|
320
|
+
}
|
|
321
|
+
get trigger() {
|
|
322
|
+
return this.getAttribute("trigger") || "hover";
|
|
323
|
+
}
|
|
324
|
+
set trigger(value) {
|
|
325
|
+
this.setAttribute("trigger", value);
|
|
326
|
+
}
|
|
327
|
+
get getPopupContainerId() {
|
|
328
|
+
return this.getAttribute("getPopupContainerId") || "";
|
|
329
|
+
}
|
|
330
|
+
set getPopupContainerId(value) {
|
|
331
|
+
this.setAttribute("getPopupContainerId", value);
|
|
332
|
+
}
|
|
333
|
+
connectedCallback() {
|
|
334
|
+
for (const element of this.children) {
|
|
335
|
+
if (element.tagName === "R-CONTENT") {
|
|
336
|
+
element.addEventListener("change", this.watchContent);
|
|
337
|
+
this.createContent(element.children);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
this.popoverTrigger();
|
|
341
|
+
this.changePlacement();
|
|
342
|
+
document.addEventListener("click", this.clickRemovePopover);
|
|
343
|
+
}
|
|
344
|
+
disconnectCallback() {
|
|
345
|
+
this.removeEventListener("mouseenter", this.hoverPopover);
|
|
346
|
+
this.removeEventListener("mouseleave", this.hoverRemovePopover);
|
|
347
|
+
this.removeEventListener("click", this.hoverPopover);
|
|
348
|
+
document.removeEventListener("click", this.clickRemovePopover);
|
|
349
|
+
}
|
|
350
|
+
attributeChangedCallback(n, o, v) {
|
|
351
|
+
if (o !== v) {
|
|
352
|
+
if (n === "trigger") {
|
|
353
|
+
this.popoverTrigger();
|
|
354
|
+
}
|
|
355
|
+
if (n === "placement") {
|
|
356
|
+
this.changePlacement();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function Custom() {
|
|
362
|
+
if (typeof document !== "undefined" && !customElements.get("r-popover")) {
|
|
363
|
+
customElements.define("r-popover", Popover);
|
|
364
|
+
return Popover;
|
|
365
|
+
} else {
|
|
366
|
+
return createCustomError("document is undefined or r-popover is exist");
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
const index = Custom();
|
|
370
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
371
|
+
__proto__: null,
|
|
372
|
+
PLACEMENT_TYPE,
|
|
373
|
+
Popover,
|
|
374
|
+
default: index
|
|
375
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
376
|
+
export {
|
|
377
|
+
PLACEMENT_TYPE as P,
|
|
378
|
+
Popover as a,
|
|
379
|
+
index as b,
|
|
380
|
+
index$1 as i
|
|
381
|
+
};
|