litos-ui 0.11.1 → 0.12.0
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/lib/base.d.ts +0 -4
- package/lib/base.js +7 -13
- package/lib/button/index.d.ts +0 -1
- package/lib/button/index.js +2 -2
- package/lib/index.d.ts +2 -16
- package/lib/index.js +85 -98
- package/lib/input/index.d.ts +0 -1
- package/lib/input/index.js +1 -2
- package/lib/list/index.d.ts +1 -1
- package/lib/litos-ui.css +1 -1
- package/lib/litos-ui.min.js +1 -0
- package/lib/radio/index.js +1 -1
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.js +63 -56
- package/package.json +2 -4
- package/styles/loading.css +58 -14
- package/styles/message.css +1 -1
- package/styles/modal_box.css +7 -0
- package/lib/dialog/dialog_container.d.ts +0 -28
- package/lib/dialog/dialog_container.js +0 -100
- package/lib/dialog/index.d.ts +0 -30
- package/lib/dialog/index.js +0 -86
- package/lib/icon/close.d.ts +0 -5
- package/lib/icon/close.js +0 -10
- package/lib/loading/index.d.ts +0 -40
- package/lib/loading/index.js +0 -135
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import BaseComponent from "../base";
|
|
2
|
-
export default class DialogContainer extends BaseComponent {
|
|
3
|
-
#private;
|
|
4
|
-
static baseName: string;
|
|
5
|
-
/** 是否显示标题栏 */
|
|
6
|
-
showHeader: boolean;
|
|
7
|
-
/** 头部内容 */
|
|
8
|
-
header?: string;
|
|
9
|
-
/** 是否显示底部 */
|
|
10
|
-
showFooter: boolean;
|
|
11
|
-
/** 是否显示取消按钮 */
|
|
12
|
-
showCancel: boolean;
|
|
13
|
-
/** 取消按钮文本 */
|
|
14
|
-
cancelText: string;
|
|
15
|
-
/** 是否显示确定按钮 */
|
|
16
|
-
showOk: boolean;
|
|
17
|
-
/** 确定按钮文本 */
|
|
18
|
-
okText: string;
|
|
19
|
-
/** 是否显示右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示 */
|
|
20
|
-
showClose: number;
|
|
21
|
-
containerClass?: string;
|
|
22
|
-
connectedCallback(): void;
|
|
23
|
-
initEvents(): void;
|
|
24
|
-
removeEvents(): void;
|
|
25
|
-
static get observedAttributes(): string[] | null | undefined;
|
|
26
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
27
|
-
render(): HTMLElement[];
|
|
28
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import p from "../base.js";
|
|
2
|
-
import { $ as d, iterate as c, on as r, off as h, shouldEventNext as g, $one as f, $$ as e, formatClass as u } from "ph-utils/dom";
|
|
3
|
-
import { initAttr as x } from "../utils/index.js";
|
|
4
|
-
const C = ":host{display:block;position:relative}:host(.l-container-close-outside){padding-top:10px;padding-right:10px}.l-dialog-main{box-shadow:0 0 8px #0000001a;border-radius:5px;background-color:#fff}.l-dialog-header{padding:10px;font-size:16px;border-bottom:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-dialog-footer{padding:10px;border-top:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-dialog-container{padding:15px 10px;font-size:14px}.l-btn-dialog-close{--nt-form-edit-height: auto;position:absolute}.l-dialog-close1{right:5px;top:6px}.l-dialog-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-dialog-close2{right:0;top:0}.l-dialog-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}";
|
|
5
|
-
class k extends p {
|
|
6
|
-
static baseName = "dialog-container";
|
|
7
|
-
/** 是否显示标题栏 */
|
|
8
|
-
showHeader = !0;
|
|
9
|
-
/** 头部内容 */
|
|
10
|
-
header;
|
|
11
|
-
/** 是否显示底部 */
|
|
12
|
-
showFooter = !0;
|
|
13
|
-
/** 是否显示取消按钮 */
|
|
14
|
-
showCancel = !0;
|
|
15
|
-
/** 取消按钮文本 */
|
|
16
|
-
cancelText = "取消";
|
|
17
|
-
/** 是否显示确定按钮 */
|
|
18
|
-
showOk = !0;
|
|
19
|
-
/** 确定按钮文本 */
|
|
20
|
-
okText = "确定";
|
|
21
|
-
/** 是否显示右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示 */
|
|
22
|
-
showClose = 1;
|
|
23
|
-
containerClass;
|
|
24
|
-
connectedCallback() {
|
|
25
|
-
this.loadStyleText(C), x(this), this.showClose === 2 && this.classList.add("l-container-close-outside"), super.connectedCallback();
|
|
26
|
-
}
|
|
27
|
-
initEvents() {
|
|
28
|
-
const t = d("[data-action]", this.root);
|
|
29
|
-
c(t, (o) => {
|
|
30
|
-
r(o, "click", this.#t);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
removeEvents() {
|
|
34
|
-
const t = d("[data-action]", this.root);
|
|
35
|
-
c(t, (o) => {
|
|
36
|
-
h(o, "click", this.#t);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
#t(t) {
|
|
40
|
-
const [o, i] = g(t, "data-action");
|
|
41
|
-
o && this.dispatchEvent(
|
|
42
|
-
new CustomEvent("dialogAction", {
|
|
43
|
-
detail: { action: i },
|
|
44
|
-
composed: !0
|
|
45
|
-
})
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
static get observedAttributes() {
|
|
49
|
-
return ["show-close"];
|
|
50
|
-
}
|
|
51
|
-
attributeChangedCallback(t, o, i) {
|
|
52
|
-
switch (t) {
|
|
53
|
-
case "show-close":
|
|
54
|
-
this.showClose = Number(i), this.showClose === 2 ? this.classList.add("l-container-close-outside") : this.classList.remove("l-container-close-outside");
|
|
55
|
-
let s = f(".l-btn-dialog-close", this.root);
|
|
56
|
-
this.showClose === 0 && s ? (h(s, "click", this.#t), s.remove()) : s ? s.className = this.#o() : (s = this.#e(), r(s, "click", this.#t), this.root.appendChild(s));
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
#o() {
|
|
61
|
-
return `l-btn-dialog-close l-dialog-close${this.showClose}`;
|
|
62
|
-
}
|
|
63
|
-
#e() {
|
|
64
|
-
const t = e("l-button", {
|
|
65
|
-
shape: "circle",
|
|
66
|
-
type: "normal",
|
|
67
|
-
class: this.#o(),
|
|
68
|
-
"data-action": "close"
|
|
69
|
-
}), o = e("l-close-icon");
|
|
70
|
-
return t.appendChild(o), t;
|
|
71
|
-
}
|
|
72
|
-
render() {
|
|
73
|
-
const t = [];
|
|
74
|
-
this.showClose !== 0 && t.push(this.#e());
|
|
75
|
-
const o = e("div", { class: "l-dialog-main" });
|
|
76
|
-
if (this.showHeader) {
|
|
77
|
-
const l = e("header", { class: "l-dialog-header" }), a = e("slot", { name: "header" });
|
|
78
|
-
a.textContent = this.header || "", l.appendChild(a), o.appendChild(l);
|
|
79
|
-
}
|
|
80
|
-
const i = e("div", {
|
|
81
|
-
class: u(["l-dialog-container", this.containerClass])
|
|
82
|
-
}), s = e("slot");
|
|
83
|
-
if (i.appendChild(s), o.appendChild(i), this.showFooter) {
|
|
84
|
-
const l = e("div", { class: "l-dialog-footer" }), a = e("slot", { name: "footer" });
|
|
85
|
-
if (this.showCancel) {
|
|
86
|
-
const n = e("l-button", { "data-action": "cancel" });
|
|
87
|
-
n.textContent = this.cancelText, a.appendChild(n);
|
|
88
|
-
}
|
|
89
|
-
if (this.showOk) {
|
|
90
|
-
const n = e("l-button", { type: "primary", "data-action": "ok" });
|
|
91
|
-
n.textContent = this.okText, a.appendChild(n);
|
|
92
|
-
}
|
|
93
|
-
l.appendChild(a), o.appendChild(l);
|
|
94
|
-
}
|
|
95
|
-
return t.push(o), t;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export {
|
|
99
|
-
k as default
|
|
100
|
-
};
|
package/lib/dialog/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
type DialogProps = {
|
|
2
|
-
/** 对话框在垂直方向位置 */
|
|
3
|
-
verticalAlign?: "top" | "bottom" | "middle";
|
|
4
|
-
/** css translate, 例如: 0,0,0 -> translate3d(0,0,0) */
|
|
5
|
-
translate?: string;
|
|
6
|
-
/** 对话框宽度 */
|
|
7
|
-
width?: string;
|
|
8
|
-
/** 是否在点击 esc 时关闭弹窗 */
|
|
9
|
-
escClose?: boolean;
|
|
10
|
-
/** 是否可以通过点击 mask 关闭对话框 */
|
|
11
|
-
maskClosable?: boolean;
|
|
12
|
-
/** 是否显示右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示 */
|
|
13
|
-
showClose?: number;
|
|
14
|
-
};
|
|
15
|
-
/** 初始化对话框配置 */
|
|
16
|
-
type DialogInitialParams = DialogProps & {
|
|
17
|
-
/** dialog 节点 */
|
|
18
|
-
el: HTMLDialogElement | string;
|
|
19
|
-
/** 返回 true 表明手动调用 done 关闭 */
|
|
20
|
-
onAction?: (action: string, done: () => void) => boolean;
|
|
21
|
-
};
|
|
22
|
-
declare const Dialog: (option?: DialogInitialParams) => {
|
|
23
|
-
init: (option: DialogInitialParams) => void;
|
|
24
|
-
open: () => void;
|
|
25
|
-
close: () => void;
|
|
26
|
-
destroy: () => void;
|
|
27
|
-
setProp: (key: keyof DialogProps, value: DialogProps[keyof DialogProps]) => void;
|
|
28
|
-
setProps: (props: DialogProps) => void;
|
|
29
|
-
};
|
|
30
|
-
export default Dialog;
|
package/lib/dialog/index.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { $one as C, hasClass as v, addClass as s, getAttr as a, on as c, off as f, removeClass as $ } from "ph-utils/dom";
|
|
2
|
-
const D = (g) => {
|
|
3
|
-
let t, l, i;
|
|
4
|
-
function w(e) {
|
|
5
|
-
e.code === "Escape" && (e.preventDefault(), n());
|
|
6
|
-
}
|
|
7
|
-
function h(e) {
|
|
8
|
-
t.isSameNode(e.target) && i && i.maskClosable && n();
|
|
9
|
-
}
|
|
10
|
-
function p(e) {
|
|
11
|
-
const o = e.detail.action;
|
|
12
|
-
i.onAction != null && i.onAction(o, n);
|
|
13
|
-
}
|
|
14
|
-
function u(e) {
|
|
15
|
-
if (!i) {
|
|
16
|
-
let o = {
|
|
17
|
-
escClose: !0,
|
|
18
|
-
verticalAlign: "top",
|
|
19
|
-
maskClosable: !0,
|
|
20
|
-
showClose: 1,
|
|
21
|
-
...e
|
|
22
|
-
};
|
|
23
|
-
if (t = C(e.el), t) {
|
|
24
|
-
v(t, "l-dialog") || s(t, "l-dialog"), l = C("l-dialog-container", t);
|
|
25
|
-
const r = a(t, "vertical-align");
|
|
26
|
-
o.verticalAlign = r || "top", s(t, `l-dialog--vertical-${o.verticalAlign}`);
|
|
27
|
-
const m = a(t, "translate") || o.translate;
|
|
28
|
-
m && t.style.setProperty(
|
|
29
|
-
"--l-dialog-translate",
|
|
30
|
-
`translate3d(${m})`
|
|
31
|
-
);
|
|
32
|
-
const A = a(t, "width") || o.width;
|
|
33
|
-
A && t.style.setProperty("--l-dialog-width", A);
|
|
34
|
-
const d = a(t, "show-close", 1);
|
|
35
|
-
d === 2 && s(t, "l-dialog-close-outside"), l && l.setAttribute("show-close", `${d}`), o.showClose = d, c(t, "keydown", w), c(t, "click", h), l && c(l, "dialogAction", p);
|
|
36
|
-
}
|
|
37
|
-
i = o;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function b() {
|
|
41
|
-
t && (t.showModal(), s(t, "l-dialog--open"), s(document.body, "l-body--dialog-open"));
|
|
42
|
-
}
|
|
43
|
-
function n() {
|
|
44
|
-
t && v(t, "l-dialog--open") && (c(
|
|
45
|
-
t,
|
|
46
|
-
"transitionend",
|
|
47
|
-
() => {
|
|
48
|
-
t.close(), $(document.body, "l-body--dialog-open");
|
|
49
|
-
},
|
|
50
|
-
{ once: !0 }
|
|
51
|
-
), $(t, "l-dialog--open"));
|
|
52
|
-
}
|
|
53
|
-
function P() {
|
|
54
|
-
t && (n(), f(t, "keydown", w), f(t, "click", h), l && f(l, "dialogAction", p), l = void 0, t = void 0);
|
|
55
|
-
}
|
|
56
|
-
function y(e, o) {
|
|
57
|
-
if (i && (i[e] = o, t))
|
|
58
|
-
if (e === "verticalAlign") {
|
|
59
|
-
const r = t.className.replace(
|
|
60
|
-
/l-dialog--vertical-\w+/g,
|
|
61
|
-
function() {
|
|
62
|
-
return `l-dialog--vertical-${o || "top"}`;
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
t.className = r;
|
|
66
|
-
} else e === "translate" ? o ? t.style.setProperty(
|
|
67
|
-
"--l-dialog-translate",
|
|
68
|
-
`translate3d(${o})`
|
|
69
|
-
) : t.style.removeProperty("--l-dialog-translate") : e === "width" ? o ? t.style.setProperty("--l-dialog-width", o) : t.style.removeProperty("--l-dialog-width") : e === "showClose" && l && l.setAttribute("show-close", `${o}`);
|
|
70
|
-
}
|
|
71
|
-
function k(e) {
|
|
72
|
-
for (const o in e)
|
|
73
|
-
y(o, e[o]);
|
|
74
|
-
}
|
|
75
|
-
return g != null && u(g), {
|
|
76
|
-
init: u,
|
|
77
|
-
open: b,
|
|
78
|
-
close: n,
|
|
79
|
-
destroy: P,
|
|
80
|
-
setProp: y,
|
|
81
|
-
setProps: k
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
export {
|
|
85
|
-
D as default
|
|
86
|
-
};
|
package/lib/icon/close.d.ts
DELETED
package/lib/icon/close.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import e from "./base.js";
|
|
2
|
-
class l extends e {
|
|
3
|
-
static baseName = "close-icon";
|
|
4
|
-
renderChildren() {
|
|
5
|
-
return '<path fill="currentColor" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path>';
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
l as default
|
|
10
|
-
};
|
package/lib/loading/index.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
type LoadingInstanceParams = {
|
|
2
|
-
/** 是否全屏显示, 默认: true */
|
|
3
|
-
fullscreen?: boolean;
|
|
4
|
-
/** 全屏显示时,是否隐藏滚动条; 默认: true */
|
|
5
|
-
lock?: boolean;
|
|
6
|
-
/** 是否为条形, 默认: false */
|
|
7
|
-
bar?: boolean;
|
|
8
|
-
/** 进度条挂载容器 */
|
|
9
|
-
to?: string | HTMLElement | null;
|
|
10
|
-
/** 显示的文本; 默认: 加载中…… */
|
|
11
|
-
text?: string;
|
|
12
|
-
/** 进度背景色 */
|
|
13
|
-
background?: string;
|
|
14
|
-
};
|
|
15
|
-
declare class LoadingInstance {
|
|
16
|
-
/** 加载容器 */
|
|
17
|
-
el: HTMLElement;
|
|
18
|
-
option: Required<Omit<LoadingInstanceParams, "to">>;
|
|
19
|
-
constructor(option?: LoadingInstanceParams);
|
|
20
|
-
/** 显示进度条 */
|
|
21
|
-
show(): void;
|
|
22
|
-
/** 隐藏进度条 */
|
|
23
|
-
hide(): void;
|
|
24
|
-
}
|
|
25
|
-
declare const _default: {
|
|
26
|
-
/** 创建并显示进度条 */
|
|
27
|
-
create(option?: LoadingInstanceParams): LoadingInstance;
|
|
28
|
-
/** 根据指令参数初始化进度条 */
|
|
29
|
-
init(id?: string): void;
|
|
30
|
-
/**
|
|
31
|
-
* 关闭加载中的元素
|
|
32
|
-
*
|
|
33
|
-
* 此函数用于关闭页面上带有特定 l-loading 属性的元素,只关闭与该 id 匹配的元素
|
|
34
|
-
* 否则,将关闭所有带有 l-loading 属性的元素
|
|
35
|
-
*
|
|
36
|
-
* @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
|
|
37
|
-
*/
|
|
38
|
-
close(id?: string): void;
|
|
39
|
-
};
|
|
40
|
-
export default _default;
|
package/lib/loading/index.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { $ as d, iterate as u, hasClass as h, $one as m, addClass as r, $$ as c } from "ph-utils/dom";
|
|
2
|
-
function f(t, e) {
|
|
3
|
-
if (h(t, "l-loading")) return;
|
|
4
|
-
let l;
|
|
5
|
-
if (e.fullscreen && (l = m("#l-loading-mask"), l != null))
|
|
6
|
-
return;
|
|
7
|
-
r(t, "l-loading"), l = c("div", { class: "l-loading-mask" }), e.background && (l.style.backgroundColor = e.background);
|
|
8
|
-
const n = c("div", { class: "l-loading-spinner" });
|
|
9
|
-
if (e.bar)
|
|
10
|
-
r(l, "l-loading-bar");
|
|
11
|
-
else {
|
|
12
|
-
const s = document.createElementNS(
|
|
13
|
-
"http://www.w3.org/2000/svg",
|
|
14
|
-
"svg"
|
|
15
|
-
);
|
|
16
|
-
s.setAttribute("viewBox", "0 0 50 50"), s.classList.add("circle");
|
|
17
|
-
const a = document.createElementNS(
|
|
18
|
-
"http://www.w3.org/2000/svg",
|
|
19
|
-
"circle"
|
|
20
|
-
);
|
|
21
|
-
if (a.classList.add("path"), a.setAttribute("cx", "25"), a.setAttribute("cy", "25"), a.setAttribute("r", "23"), a.setAttribute("fill", "none"), s.appendChild(a), n.appendChild(s), e.text) {
|
|
22
|
-
const i = c("p", {
|
|
23
|
-
class: "l-loading-text",
|
|
24
|
-
textContent: e.text
|
|
25
|
-
});
|
|
26
|
-
n.appendChild(i);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (e.fullscreen) {
|
|
30
|
-
const s = ["l-loading-fullscreen"];
|
|
31
|
-
e.lock && s.push("l-loading-lock"), t.classList.add(...s), l.id = "l-loading-mask";
|
|
32
|
-
}
|
|
33
|
-
l.appendChild(n), t.appendChild(l), setTimeout(() => {
|
|
34
|
-
e.bar ? r(l, "l-loading-bar--start") : l.style.opacity = "1";
|
|
35
|
-
}, 10);
|
|
36
|
-
}
|
|
37
|
-
function b(t, e) {
|
|
38
|
-
const l = e.fullscreen ? "#" : ".", n = d(`${l}l-loading-mask`, t);
|
|
39
|
-
u(n, (s) => {
|
|
40
|
-
function a() {
|
|
41
|
-
const g = ["l-loading-bar--start", "l-loading-bar--finish"];
|
|
42
|
-
t.tagName === "BODY" && g.push(
|
|
43
|
-
"l-loading",
|
|
44
|
-
"l-loading-fullscreen",
|
|
45
|
-
"l-loading-lock"
|
|
46
|
-
), t.classList.remove(...g), s != null && t.contains(s) && (t.removeChild(s), s = void 0);
|
|
47
|
-
}
|
|
48
|
-
let i = -1;
|
|
49
|
-
s.addEventListener(
|
|
50
|
-
"transitionend",
|
|
51
|
-
() => {
|
|
52
|
-
cancelAnimationFrame(i), i = requestAnimationFrame(() => {
|
|
53
|
-
a();
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
{ once: !0 }
|
|
57
|
-
), e.bar ? t.classList.add("l-loading-bar--finish") : s.style.opacity = "0", setTimeout(() => {
|
|
58
|
-
a();
|
|
59
|
-
}, 500);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
class p {
|
|
63
|
-
/** 加载容器 */
|
|
64
|
-
el;
|
|
65
|
-
option;
|
|
66
|
-
constructor(e) {
|
|
67
|
-
this.option = {
|
|
68
|
-
fullscreen: !0,
|
|
69
|
-
lock: !0,
|
|
70
|
-
bar: !1,
|
|
71
|
-
text: "加载中……",
|
|
72
|
-
background: "",
|
|
73
|
-
...e
|
|
74
|
-
};
|
|
75
|
-
const l = (e || {}).to;
|
|
76
|
-
let n = null;
|
|
77
|
-
l != null && (typeof l == "string" ? n = document.querySelector(l) : n = l), (n == null || this.option.fullscreen) && (n = document.body), this.el = n, this.show();
|
|
78
|
-
}
|
|
79
|
-
/** 显示进度条 */
|
|
80
|
-
show() {
|
|
81
|
-
f(this.el, this.option);
|
|
82
|
-
}
|
|
83
|
-
/** 隐藏进度条 */
|
|
84
|
-
hide() {
|
|
85
|
-
b(this.el, this.option);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function o(t) {
|
|
89
|
-
const e = t.getAttribute("l-loading-text"), l = t.getAttribute("l-loading-lock");
|
|
90
|
-
return {
|
|
91
|
-
background: t.getAttribute("l-loading-background"),
|
|
92
|
-
text: e ? e === "0" || e === "false" ? void 0 : e : "加载中……",
|
|
93
|
-
fullscreen: t.hasAttribute("l-loading-fullscreen"),
|
|
94
|
-
lock: !(l === "0" || l === "false"),
|
|
95
|
-
bar: t.hasAttribute("l-loading-bar")
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
const x = {
|
|
99
|
-
/** 创建并显示进度条 */
|
|
100
|
-
create(t) {
|
|
101
|
-
return new p(t);
|
|
102
|
-
},
|
|
103
|
-
/** 根据指令参数初始化进度条 */
|
|
104
|
-
init(t) {
|
|
105
|
-
const e = t ? `[l-loading="${t}"]` : "[l-loading]", l = d(e);
|
|
106
|
-
u(l, (n) => {
|
|
107
|
-
const s = o(n);
|
|
108
|
-
f(
|
|
109
|
-
s.fullscreen ? document.body : n,
|
|
110
|
-
o(n)
|
|
111
|
-
);
|
|
112
|
-
});
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* 关闭加载中的元素
|
|
116
|
-
*
|
|
117
|
-
* 此函数用于关闭页面上带有特定 l-loading 属性的元素,只关闭与该 id 匹配的元素
|
|
118
|
-
* 否则,将关闭所有带有 l-loading 属性的元素
|
|
119
|
-
*
|
|
120
|
-
* @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
|
|
121
|
-
*/
|
|
122
|
-
close(t) {
|
|
123
|
-
const e = t ? `[l-loading="${t}"]` : "[l-loading]", l = d(e);
|
|
124
|
-
u(l, (n) => {
|
|
125
|
-
const s = o(n);
|
|
126
|
-
b(
|
|
127
|
-
s.fullscreen ? document.body : n,
|
|
128
|
-
o(n)
|
|
129
|
-
);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
export {
|
|
134
|
-
x as default
|
|
135
|
-
};
|