ranui 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button/index.d.ts +33 -0
- package/dist/components/button/index.js +3 -2
- package/dist/components/icon/index.js +2 -2
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.d.ts +183 -0
- package/dist/components/input/index.js +2 -1
- package/dist/components/message/index.js +1 -1
- package/dist/components/option/index.js +1 -1
- package/dist/components/player/index.d.ts +179 -490
- package/dist/components/player/index.js +6 -5
- package/dist/components/preview/index.js +4 -4
- package/dist/components/progress/index.js +2 -2
- package/dist/components/radar/index.js +2 -2
- package/dist/components/scratch/index.d.ts +19 -0
- package/dist/components/select/index.d.ts +5 -1
- package/dist/components/select/index.js +4 -4
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/tab/index.d.ts +5 -0
- package/dist/components/tab/index.js +2 -2
- package/dist/components/tabpane/index.d.ts +5 -0
- package/dist/components/tabpane/index.js +1 -1
- package/dist/{index-aea75a9f.js → index-01b17e26.js} +1 -1
- package/dist/{index-48653b79.js → index-0d5b9435.js} +1 -1
- package/dist/index-1048a998.js +447 -0
- package/dist/{index-f6d6982d.js → index-1b73beee.js} +65 -13
- package/dist/index-2d16a084.js +197 -0
- package/dist/{index-0e7229ea.js → index-3cf72afd.js} +8 -6
- package/dist/{index-a43b144f.js → index-4443363f.js} +1 -1
- package/dist/{index-a1a53af6.js → index-458debf7.js} +2 -2
- package/dist/{index-7f513a14.js → index-7216d6b0.js} +2 -2
- package/dist/index-73ce455b.js +264 -0
- package/dist/{index-d2d69b06.js → index-7913ec46.js} +27 -13
- package/dist/{index-5975bbc0.js → index-b7790662.js} +1 -1
- package/dist/{index-a216f328.js → index-c14450a9.js} +1 -1
- package/dist/{index-b90299ca.js → index-e03d23e7.js} +1 -1
- package/dist/{index-b2be6bef.js → index-e2e5d725.js} +1087 -1069
- package/dist/index.js +15 -15
- package/dist/style.css +1 -1
- package/dist/umd/components/button/index.d.ts +33 -0
- package/dist/umd/components/input/index.d.ts +183 -0
- package/dist/umd/components/player/index.d.ts +179 -490
- package/dist/umd/components/scratch/index.d.ts +19 -0
- package/dist/umd/components/select/index.d.ts +5 -1
- package/dist/umd/components/tab/index.d.ts +5 -0
- package/dist/umd/components/tabpane/index.d.ts +5 -0
- package/dist/umd/index.umd.cjs +6 -6
- package/dist/umd/style.css +1 -1
- package/package.json +5 -8
- package/dist/index-183517e7.js +0 -265
- package/dist/index-4d873a42.js +0 -195
- package/dist/index-ecaed5cc.js +0 -439
|
@@ -4,12 +4,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { a as addClassToElement, r as removeClassToElement } from "./index-
|
|
7
|
+
import { a as addClassToElement, r as removeClassToElement, i as isMobile, b as generateThrottle } from "./index-7913ec46.js";
|
|
8
8
|
import { i as isDisabled, c as createCustomError } from "./index-57492b9b.js";
|
|
9
9
|
import "./components/option/index.js";
|
|
10
|
-
import "./index-
|
|
11
|
-
import "./index-
|
|
12
|
-
const f7170ee498e0dd32cbdcb63fba8f75cc = ':host{position:relative;display:inline-block;cursor:pointer;height:32px}:host ::slotted(r-option){display:none}:host([disabled]){cursor:not-allowed;pointer-events:all;opacity:.6}:host([type="text"])::part(selection){border:none}:host([type="text"])::part(icon){display:none}:host(:not([disabled]):hover) .select{cursor:pointer}:host(:not([disabled]):hover) .selection{border:1px solid #1890ff}:host(:not([disabled]):hover) .selection-search{cursor:pointer}:host(:not([disabled]):hover) .selection-item{cursor:pointer;color:#bfbfbf}:host(:not([disabled]):focus) .selection{border:1px solid #1890ff}:host(:not([disabled]):focus) .selection-search{cursor:pointer}:host(:not([disabled]):focus) .selection-item{cursor:pointer;color:#bfbfbf}:host .selection-search{display:none}:host([showSearch]:not([disabled])) .selection-search{cursor:text;display:block}:host([showSearch]:not([disabled])) .selection-item{cursor:pointer}:host([showSearch]:not([disabled]):focus) .selection-search{display:block;cursor:text;opacity:1}.ran-select{width:100%;height:100%;box-sizing:border-box;margin:0;padding:0;color:#000000e0;font-size:14px;line-height:1.57142857;list-style:none;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";position:relative;display:inline-block}.ran-select .selection{position:relative;background-color:#fff;border:1px solid #d9d9d9;transition:all .2s cubic-bezier(.645,.045,.355,1);width:100%;height:100%;padding:0 11px;box-sizing:border-box;margin:0;color:#000000e0;font-size:14px;line-height:1.57142857;list-style:none;font-family:inherit;display:flex;border-radius:6px}.ran-select .selection-search{position:absolute;top:0;left:0;height:100%;inset-inline-start:11px;inset-inline-end:11px;opacity:0;margin:0;padding:0;background:transparent;border:none;outline:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-family:inherit;cursor:not-allowed}.ran-select .selection-search::-webkit-search-cancel-button{display:none;-webkit-appearance:none}.ran-select .selection-search::part(ran-input){border:none;padding:0;height:100%;outline:none}.ran-select .selection-search::part(ran-input):active{border:none;padding:0;height:100%;outline:none;border-color:transparent;box-shadow:none;border-right-width:0px}.ran-select .selection-item{position:absolute;top:0;left:12px;margin:0;padding:0;background:transparent;border:none;outline:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-family:inherit;height:100%;-webkit-user-select:none;user-select:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer}.ran-select .selection-select{color:#00000040}.ran-select .selection .icon{display:flex;align-items:center;color:#00000040;font-style:normal;text-align:center;text-transform:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;top:50%;inset-inline-start:auto;inset-inline-end:8px;height:12px;margin-top:-3px;font-size:12px;pointer-events:none}\n';
|
|
10
|
+
import "./index-7216d6b0.js";
|
|
11
|
+
import "./index-1048a998.js";
|
|
12
|
+
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;cursor:pointer;height:32px;outline:0;-webkit-tap-highlight-color:transparent}:host,:host(:focus),:host(:active){outline:0;-webkit-tap-highlight-color:transparent}:host ::slotted(r-option){display:none}:host([disabled]){cursor:not-allowed;pointer-events:all;opacity:.6}:host([type="text"])::part(selection){border:none}:host([type="text"])::part(icon){display:none}:host(:not([disabled]):hover) .select{cursor:pointer}:host(:not([disabled]):hover) .selection{border:1px solid #1890ff}:host(:not([disabled]):hover) .selection-search{cursor:pointer}:host(:not([disabled]):hover) .selection-item{cursor:pointer;color:#bfbfbf}:host(:not([disabled]):focus) .selection{border:1px solid #1890ff}:host(:not([disabled]):focus) .selection-search{cursor:pointer}:host(:not([disabled]):focus) .selection-item{cursor:pointer;color:#bfbfbf}:host .selection-search{display:none}:host([showSearch]:not([disabled])) .selection-search{cursor:text;display:block}:host([showSearch]:not([disabled])) .selection-item{cursor:pointer}:host([showSearch]:not([disabled]):focus) .selection-search{display:block;cursor:text;opacity:1}.ran-select{width:100%;height:100%;box-sizing:border-box;margin:0;padding:0;color:#000000e0;font-size:14px;line-height:1.57142857;list-style:none;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";position:relative;display:inline-block}.ran-select .selection{position:relative;background-color:#fff;border:1px solid #d9d9d9;transition:all .2s cubic-bezier(.645,.045,.355,1);width:100%;height:100%;padding:0 11px;box-sizing:border-box;margin:0;color:#000000e0;font-size:14px;line-height:1.57142857;list-style:none;font-family:inherit;display:flex;border-radius:6px}.ran-select .selection-search{position:absolute;top:0;left:0;height:100%;inset-inline-start:11px;inset-inline-end:11px;opacity:0;margin:0;padding:0;background:transparent;border:none;outline:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-family:inherit;cursor:not-allowed}.ran-select .selection-search::-webkit-search-cancel-button{display:none;-webkit-appearance:none}.ran-select .selection-search::part(ran-input){border:none;padding:0;height:100%;outline:none}.ran-select .selection-search::part(ran-input):active{border:none;padding:0;height:100%;outline:none;border-color:transparent;box-shadow:none;border-right-width:0px}.ran-select .selection-item{position:absolute;top:0;left:12px;margin:0;padding:0;background:transparent;border:none;outline:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-family:inherit;height:100%;-webkit-user-select:none;user-select:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer}.ran-select .selection-select{color:#00000040}.ran-select .selection .icon{display:flex;align-items:center;color:#00000040;font-style:normal;text-align:center;text-transform:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;top:50%;inset-inline-start:auto;inset-inline-end:8px;height:12px;margin-top:-3px;font-size:12px;pointer-events:none}\n';
|
|
13
13
|
const placementDirection = {
|
|
14
14
|
bottom: {
|
|
15
15
|
add: "ran-select-dropdown-down-in",
|
|
@@ -20,6 +20,7 @@ const placementDirection = {
|
|
|
20
20
|
remove: "ran-select-dropdown-up-out"
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
+
const searchThrottle = generateThrottle();
|
|
23
24
|
class Select extends HTMLElement {
|
|
24
25
|
constructor() {
|
|
25
26
|
super();
|
|
@@ -40,6 +41,7 @@ class Select extends HTMLElement {
|
|
|
40
41
|
__publicField(this, "_activeOption");
|
|
41
42
|
__publicField(this, "_text");
|
|
42
43
|
__publicField(this, "_selector");
|
|
44
|
+
__publicField(this, "onSearch");
|
|
43
45
|
/**
|
|
44
46
|
* @description: 移除 select dropdown
|
|
45
47
|
* @return {*}
|
|
@@ -130,7 +132,8 @@ class Select extends HTMLElement {
|
|
|
130
132
|
this.placementPosition();
|
|
131
133
|
});
|
|
132
134
|
__publicField(this, "removeDropDownTimeId", () => {
|
|
133
|
-
|
|
135
|
+
this._search.setAttribute("value", "");
|
|
136
|
+
if (this.action.includes("hover") && !isMobile()) {
|
|
134
137
|
clearTimeout(this.removeTimeId);
|
|
135
138
|
this.removeTimeId = void 0;
|
|
136
139
|
}
|
|
@@ -169,6 +172,9 @@ class Select extends HTMLElement {
|
|
|
169
172
|
this._text.setAttribute("title", label);
|
|
170
173
|
this._search.setAttribute("placeholder", label);
|
|
171
174
|
}
|
|
175
|
+
const rect = this.getBoundingClientRect();
|
|
176
|
+
const { height } = rect;
|
|
177
|
+
this._text.style.setProperty("line-height", `${height}px`);
|
|
172
178
|
if (this._activeOption) {
|
|
173
179
|
removeClassToElement(
|
|
174
180
|
this._activeOption,
|
|
@@ -196,8 +202,18 @@ class Select extends HTMLElement {
|
|
|
196
202
|
if (!this._selectDropdown) {
|
|
197
203
|
const container = document.getElementById(this.getPopupContainerId) || document.body;
|
|
198
204
|
this._selectDropdown = document.createElement("div");
|
|
205
|
+
this._selectDropdown.style.setProperty(
|
|
206
|
+
"-webkit-tap-highlight-color",
|
|
207
|
+
"transparent"
|
|
208
|
+
);
|
|
209
|
+
this._selectDropdown.style.setProperty("outline", "0");
|
|
199
210
|
this._selectDropdown.addEventListener("click", this.clickOption);
|
|
200
211
|
this._selectionDropdown = document.createElement("div");
|
|
212
|
+
this._selectionDropdown.style.setProperty(
|
|
213
|
+
"-webkit-tap-highlight-color",
|
|
214
|
+
"transparent"
|
|
215
|
+
);
|
|
216
|
+
this._selectionDropdown.style.setProperty("outline", "0");
|
|
201
217
|
if (this.dropdownclass) {
|
|
202
218
|
this._selectionDropdown.setAttribute(
|
|
203
219
|
"class",
|
|
@@ -206,7 +222,7 @@ class Select extends HTMLElement {
|
|
|
206
222
|
} else {
|
|
207
223
|
this._selectionDropdown.setAttribute("class", "ranui-select-dropdown");
|
|
208
224
|
}
|
|
209
|
-
if (this.action.includes("hover")) {
|
|
225
|
+
if (this.action.includes("hover") && !isMobile()) {
|
|
210
226
|
this._selectDropdown.addEventListener("mouseleave", this.selectBlur);
|
|
211
227
|
this._selectDropdown.addEventListener(
|
|
212
228
|
"mouseenter",
|
|
@@ -253,7 +269,16 @@ class Select extends HTMLElement {
|
|
|
253
269
|
this._optionLabelMapValue.set(label, value);
|
|
254
270
|
this._optionValueMapLabel.set(value, label);
|
|
255
271
|
});
|
|
256
|
-
this._optionList
|
|
272
|
+
this.createSelectDropdownContent(this._optionList);
|
|
273
|
+
});
|
|
274
|
+
__publicField(this, "createSelectDropdownContent", (options = []) => {
|
|
275
|
+
var _a, _b;
|
|
276
|
+
if (options.length === 0) {
|
|
277
|
+
(_a = this._selectDropdown) == null ? void 0 : _a.style.setProperty("display", "none");
|
|
278
|
+
} else {
|
|
279
|
+
(_b = this._selectDropdown) == null ? void 0 : _b.style.setProperty("display", "block");
|
|
280
|
+
}
|
|
281
|
+
options.forEach((item) => {
|
|
257
282
|
if (this._selectionDropdown) {
|
|
258
283
|
const { label, value } = item;
|
|
259
284
|
const selectOptionItem = document.createElement("div");
|
|
@@ -299,9 +324,36 @@ class Select extends HTMLElement {
|
|
|
299
324
|
this._text.setAttribute("title", label);
|
|
300
325
|
});
|
|
301
326
|
__publicField(this, "changeSearch", (e) => {
|
|
327
|
+
const value = e.detail.value || "";
|
|
328
|
+
this.dispatchEvent(
|
|
329
|
+
new CustomEvent("search", {
|
|
330
|
+
detail: { value }
|
|
331
|
+
})
|
|
332
|
+
);
|
|
333
|
+
if (this._selectionDropdown) {
|
|
334
|
+
this._selectionDropdown.innerHTML = "";
|
|
335
|
+
}
|
|
336
|
+
if (value.length > 0) {
|
|
337
|
+
const options = this._optionList.map((item) => {
|
|
338
|
+
const { label } = item;
|
|
339
|
+
if (`${label}`.toLowerCase().includes(value)) {
|
|
340
|
+
return { label, value: item.value };
|
|
341
|
+
}
|
|
342
|
+
return void 0;
|
|
343
|
+
}).filter((item) => item);
|
|
344
|
+
this.createSelectDropdownContent(options);
|
|
345
|
+
} else {
|
|
346
|
+
this.createSelectDropdownContent(this._optionList);
|
|
347
|
+
}
|
|
302
348
|
});
|
|
303
349
|
__publicField(this, "setShowSearch", () => {
|
|
304
|
-
this.
|
|
350
|
+
this.onSearch = searchThrottle(this.changeSearch);
|
|
351
|
+
this._search.addEventListener("change", this.onSearch);
|
|
352
|
+
this._search.addEventListener("click", this.onSearch);
|
|
353
|
+
});
|
|
354
|
+
__publicField(this, "removeShowSearch", () => {
|
|
355
|
+
this._search.removeEventListener("change", this.onSearch);
|
|
356
|
+
this._search.removeEventListener("click", this.onSearch);
|
|
305
357
|
});
|
|
306
358
|
__publicField(this, "listenSlotChange", () => {
|
|
307
359
|
this._slot.addEventListener("slotchange", this.addOptionToSlot);
|
|
@@ -312,14 +364,14 @@ class Select extends HTMLElement {
|
|
|
312
364
|
__publicField(this, "listenActionEvent", () => {
|
|
313
365
|
this.removeEventListener("mouseenter", this.selectMouseDown);
|
|
314
366
|
this.removeEventListener("mouseleave", this.selectBlur);
|
|
315
|
-
this.removeEventListener("
|
|
367
|
+
this.removeEventListener("click", this.selectMouseDown);
|
|
316
368
|
this.removeEventListener("blur", this.selectBlur);
|
|
317
|
-
if (this.action.includes("hover")) {
|
|
369
|
+
if (this.action.includes("hover") && !isMobile()) {
|
|
318
370
|
this.addEventListener("mouseenter", this.selectMouseDown);
|
|
319
371
|
this.addEventListener("mouseleave", this.selectBlur);
|
|
320
372
|
}
|
|
321
373
|
if (this.action.includes("click")) {
|
|
322
|
-
this.addEventListener("
|
|
374
|
+
this.addEventListener("click", this.selectMouseDown);
|
|
323
375
|
this.addEventListener("blur", this.selectBlur);
|
|
324
376
|
}
|
|
325
377
|
});
|
|
@@ -377,7 +429,7 @@ class Select extends HTMLElement {
|
|
|
377
429
|
"dropdownclass",
|
|
378
430
|
// 弹窗的类名
|
|
379
431
|
"action"
|
|
380
|
-
// 触发下拉框的行为,click还是hover
|
|
432
|
+
// 触发下拉框的行为, click 还是 hover ,hover 在 isMobile 移动端无效
|
|
381
433
|
];
|
|
382
434
|
}
|
|
383
435
|
get value() {
|
|
@@ -474,7 +526,7 @@ class Select extends HTMLElement {
|
|
|
474
526
|
var _a;
|
|
475
527
|
this.removeEventListener("mouseenter", this.selectMouseDown);
|
|
476
528
|
this.removeEventListener("mouseleave", this.selectBlur);
|
|
477
|
-
this.removeEventListener("
|
|
529
|
+
this.removeEventListener("click", this.selectMouseDown);
|
|
478
530
|
this.removeEventListener("blur", this.selectBlur);
|
|
479
531
|
this.removeSelectDropdown();
|
|
480
532
|
(_a = this._selectDropdown) == null ? void 0 : _a.removeEventListener("click", this.clickOption);
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { j as judgeDevice } from "./index-7913ec46.js";
|
|
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 {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
__publicField(this, "_btn");
|
|
14
|
+
__publicField(this, "_btnContent");
|
|
15
|
+
__publicField(this, "_iconElement");
|
|
16
|
+
__publicField(this, "_slot");
|
|
17
|
+
__publicField(this, "_shadowDom");
|
|
18
|
+
__publicField(this, "debounceTimeId");
|
|
19
|
+
/**
|
|
20
|
+
* @description: 设置button的icon
|
|
21
|
+
* @return {*}
|
|
22
|
+
*/
|
|
23
|
+
__publicField(this, "setIcon", () => {
|
|
24
|
+
if (this.icon) {
|
|
25
|
+
const { width, height } = this._slot.getBoundingClientRect();
|
|
26
|
+
const size = Math.min(width, height);
|
|
27
|
+
if (this._iconElement) {
|
|
28
|
+
this._iconElement.setAttribute("name", this.icon);
|
|
29
|
+
} else {
|
|
30
|
+
this._iconElement = document.createElement("r-icon");
|
|
31
|
+
this._iconElement.setAttribute("name", this.icon);
|
|
32
|
+
this._iconElement.setAttribute("color", "currentColor");
|
|
33
|
+
this._iconElement.setAttribute("class", "icon");
|
|
34
|
+
this._slot.insertAdjacentElement("beforebegin", this._iconElement);
|
|
35
|
+
}
|
|
36
|
+
if (this.iconSize) {
|
|
37
|
+
this._iconElement.setAttribute("size", this.iconSize);
|
|
38
|
+
} else {
|
|
39
|
+
this._iconElement.setAttribute("size", `${size - 5}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
__publicField(this, "mousedown", (event) => {
|
|
44
|
+
if (judgeDevice() !== "pc")
|
|
45
|
+
return;
|
|
46
|
+
if (!this.disabled || this.disabled === "false") {
|
|
47
|
+
this.debounceMouseEvent();
|
|
48
|
+
const { left, top } = this.getBoundingClientRect();
|
|
49
|
+
this._btn.style.setProperty("--ran-x", event.clientX - left + "px");
|
|
50
|
+
this._btn.style.setProperty("--ran-y", event.clientY - top + "px");
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
__publicField(this, "mouseup", (event) => {
|
|
54
|
+
if (judgeDevice() !== "pc")
|
|
55
|
+
return;
|
|
56
|
+
if (this.debounceTimeId)
|
|
57
|
+
return;
|
|
58
|
+
this.debounceTimeId = setTimeout(() => {
|
|
59
|
+
this._btn.style.removeProperty("--ran-x");
|
|
60
|
+
this._btn.style.removeProperty("--ran-y");
|
|
61
|
+
this.debounceMouseEvent();
|
|
62
|
+
}, 600);
|
|
63
|
+
});
|
|
64
|
+
__publicField(this, "debounceMouseEvent", () => {
|
|
65
|
+
clearTimeout(this.debounceTimeId);
|
|
66
|
+
this.debounceTimeId = void 0;
|
|
67
|
+
});
|
|
68
|
+
__publicField(this, "handlerExternalCss", () => {
|
|
69
|
+
if (this.sheet) {
|
|
70
|
+
try {
|
|
71
|
+
const sheet = new CSSStyleSheet();
|
|
72
|
+
sheet.insertRule(this.sheet);
|
|
73
|
+
this._shadowDom.adoptedStyleSheets = [sheet];
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error(
|
|
76
|
+
`Failed to parse the rule in CSSStyleSheet: ${this.sheet}`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
this._slot = document.createElement("slot");
|
|
82
|
+
this._btnContent = document.createElement("div");
|
|
83
|
+
this._btn = document.createElement("div");
|
|
84
|
+
this._btn.setAttribute("class", "ran-btn");
|
|
85
|
+
this._btn.setAttribute("part", "ran-btn");
|
|
86
|
+
this._btnContent.setAttribute("class", "ran-btn-content");
|
|
87
|
+
this._btnContent.setAttribute("part", "ran-btn-content");
|
|
88
|
+
this._btnContent.appendChild(this._slot);
|
|
89
|
+
this._slot.setAttribute("class", "slot");
|
|
90
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
91
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
92
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
93
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
94
|
+
this._shadowDom = shadowRoot;
|
|
95
|
+
this._btn.appendChild(this._btnContent);
|
|
96
|
+
shadowRoot.appendChild(this._btn);
|
|
97
|
+
}
|
|
98
|
+
static get observedAttributes() {
|
|
99
|
+
return ["disabled", "icon", "effect", "iconSize", "sheet"];
|
|
100
|
+
}
|
|
101
|
+
get sheet() {
|
|
102
|
+
return this.getAttribute("sheet") || "";
|
|
103
|
+
}
|
|
104
|
+
set sheet(value) {
|
|
105
|
+
this.setAttribute("sheet", value || "");
|
|
106
|
+
}
|
|
107
|
+
get disabled() {
|
|
108
|
+
return isDisabled(this);
|
|
109
|
+
}
|
|
110
|
+
set disabled(value) {
|
|
111
|
+
if (!value || value === "false") {
|
|
112
|
+
this.removeAttribute("disabled");
|
|
113
|
+
this.removeAttribute("aria-disabled");
|
|
114
|
+
} else {
|
|
115
|
+
this.setAttribute("disabled", "");
|
|
116
|
+
this.setAttribute("aria-disabled", "true");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
get iconSize() {
|
|
120
|
+
return this.getAttribute("iconSize") || "";
|
|
121
|
+
}
|
|
122
|
+
set iconSize(value) {
|
|
123
|
+
if (!value || value === "false") {
|
|
124
|
+
this.removeAttribute("iconSize");
|
|
125
|
+
} else {
|
|
126
|
+
this.setAttribute("iconSize", value);
|
|
127
|
+
this.setIcon();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
get icon() {
|
|
131
|
+
return this.getAttribute("icon") || "";
|
|
132
|
+
}
|
|
133
|
+
set icon(value) {
|
|
134
|
+
if (!value || value === "false") {
|
|
135
|
+
this.removeAttribute("icon");
|
|
136
|
+
} else {
|
|
137
|
+
this.setAttribute("icon", value);
|
|
138
|
+
this.setIcon();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
get effect() {
|
|
142
|
+
return this.getAttribute("effect") || "";
|
|
143
|
+
}
|
|
144
|
+
set effect(value) {
|
|
145
|
+
if (falseList.includes(value) || !value) {
|
|
146
|
+
this.removeAttribute("effect");
|
|
147
|
+
} else {
|
|
148
|
+
this.setAttribute("effect", value);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
connectedCallback() {
|
|
152
|
+
this._btn.addEventListener("mousedown", this.mousedown);
|
|
153
|
+
this._btn.addEventListener("mouseup", this.mouseup);
|
|
154
|
+
this.handlerExternalCss();
|
|
155
|
+
this.setIcon();
|
|
156
|
+
this.setAttribute("role", "button");
|
|
157
|
+
this.setAttribute("tabindex", "0");
|
|
158
|
+
}
|
|
159
|
+
disconnectCallback() {
|
|
160
|
+
this._btn.removeEventListener("mousedown", this.mousedown);
|
|
161
|
+
this._btn.removeEventListener("mouseup", this.mouseup);
|
|
162
|
+
}
|
|
163
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
164
|
+
if (name === "disabled" && this._btnContent) {
|
|
165
|
+
if (!newValue || newValue === "false") {
|
|
166
|
+
this._btnContent.setAttribute("disabled", "");
|
|
167
|
+
} else {
|
|
168
|
+
this._btnContent.removeAttribute("disabled");
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (name === "icon" && this._btnContent && oldValue !== newValue)
|
|
172
|
+
this.setIcon();
|
|
173
|
+
if (name === "iconSize" && this._btnContent && oldValue !== newValue)
|
|
174
|
+
this._btnContent.setAttribute("iconSize", newValue);
|
|
175
|
+
if (name === "sheet" && this._shadowDom && oldValue !== newValue)
|
|
176
|
+
this.handlerExternalCss();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function Custom() {
|
|
180
|
+
if (typeof document !== "undefined" && !customElements.get("r-button")) {
|
|
181
|
+
customElements.define("r-button", Button);
|
|
182
|
+
return Button;
|
|
183
|
+
} else {
|
|
184
|
+
return createCustomError("document is undefined or r-button is exist");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const index = Custom();
|
|
188
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
189
|
+
__proto__: null,
|
|
190
|
+
Button,
|
|
191
|
+
default: index
|
|
192
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
193
|
+
export {
|
|
194
|
+
Button as B,
|
|
195
|
+
index as a,
|
|
196
|
+
index$1 as i
|
|
197
|
+
};
|
|
@@ -4,9 +4,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { a as addClassToElement } from "./index-
|
|
7
|
+
import { c as createDocumentFragment, a as addClassToElement } from "./index-7913ec46.js";
|
|
8
8
|
import { i as isDisabled, r as removeClassToElementChild } from "./index-57492b9b.js";
|
|
9
|
-
const f7170ee498e0dd32cbdcb63fba8f75cc = '.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';
|
|
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';
|
|
10
10
|
function CustomElement() {
|
|
11
11
|
if (typeof window !== "undefined" && !customElements.get("r-tabs")) {
|
|
12
12
|
class Tabs extends HTMLElement {
|
|
@@ -200,10 +200,12 @@ function CustomElement() {
|
|
|
200
200
|
this._slot = document.createElement("slot");
|
|
201
201
|
this._wrap.appendChild(this._slot);
|
|
202
202
|
this._content.appendChild(this._wrap);
|
|
203
|
-
this._header.appendChild(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
this._container.appendChild(
|
|
203
|
+
this._header.appendChild(
|
|
204
|
+
createDocumentFragment([this._nav, this._line])
|
|
205
|
+
);
|
|
206
|
+
this._container.appendChild(
|
|
207
|
+
createDocumentFragment([this._header, this._content])
|
|
208
|
+
);
|
|
207
209
|
this.tabHeaderKeyMapIndex = {};
|
|
208
210
|
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
209
211
|
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { p as perToNum } from "./index-
|
|
7
|
+
import { p as perToNum } from "./index-7913ec46.js";
|
|
8
8
|
import { c as createCustomError } from "./index-57492b9b.js";
|
|
9
9
|
const index$2 = "";
|
|
10
10
|
const attributes = ["percent", "type", "total", "dot"];
|
|
@@ -4,9 +4,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { g as getPixelRatio } from "./index-
|
|
7
|
+
import { g as getPixelRatio } from "./index-7913ec46.js";
|
|
8
8
|
import { c as createCustomError } from "./index-57492b9b.js";
|
|
9
|
-
const f7170ee498e0dd32cbdcb63fba8f75cc = ".ran-radar{position:relative;width:100%;height:100%;display:block}\n";
|
|
9
|
+
const f7170ee498e0dd32cbdcb63fba8f75cc = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.ran-radar{position:relative;width:100%;height:100%;display:block}\n";
|
|
10
10
|
const BACKGROUND_COLOR = "rgba(0,0,0,0)";
|
|
11
11
|
const FONT_COLOR = "rgba(0,0,0,1)";
|
|
12
12
|
const POLYGON_COLOR = "#e6e6e6";
|
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { s as str2Xml } from "./index-
|
|
7
|
+
import { s as str2Xml } from "./index-7913ec46.js";
|
|
8
8
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
9
9
|
const v = glob[path];
|
|
10
10
|
if (v) {
|
|
@@ -14,7 +14,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
|
14
14
|
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
const f7170ee498e0dd32cbdcb63fba8f75cc = ":host{display:inline-flex}:host .ran-icon{display:flex}:host([spin]){animation-name:rotate;animation-duration:1.4s;animation-timing-function:linear;animation-iteration-count:infinite}@keyframes rotate{to{transform:rotate(360deg)}}\n";
|
|
17
|
+
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:inline-flex}:host .ran-icon{display:flex}:host([spin]){animation-name:rotate;animation-duration:1.4s;animation-timing-function:linear;animation-iteration-count:infinite}@keyframes rotate{to{transform:rotate(360deg)}}\n";
|
|
18
18
|
const X_LINKS_NS = "http://www.w3.org/1999/xlink";
|
|
19
19
|
const X_LINK_HREF = "xlink:href";
|
|
20
20
|
function Custom() {
|